Skip to content

Javascript APIs

Nicholas Jitkoff edited this page Mar 26, 2024 · 1 revision

Translucent adds a Javascript bridge to communicate with the native app.

Standard Web APIs

The following are available through existing web apis:

  • Camera
  • Microphone
  • Location

Messaging the native bridge

To access other apis, send messages through the window.widget object:

widget.postMessage({})

Battery API

To request battery level and state, use: await widget.postMessage({"action":"battery"})

Which will respond with a json status: {level: "95", state: "0"}

Clone this wiki locally