Javascript APIs - arfct/translucent GitHub Wiki

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"}