@prescrire/bridge

5.0.1 • Public • Published

Embedded Bridge

This Bridge can be embedded into a BrowserView and InAppBrowser. It provides the mentioned windows with access to API methods of the Bridge marked as external. An object window.EmbeddedBridge is created in the window scope. There is a public method window.EmbeddedBridge.api({string}methodName, {object}params) which returns a promise (this is an async function). It invokes API methods of the app. In addition, EmbeddedBridge invokes "get-supported-api-methods" method automatically on initialization and sets returned results to an attribute named supported_api_methods to a body element of the auth page: <body supported_api_methods="close-authentication get-supported-api-methods"> This helps to utilize CSS rules like [supported_api_methods~="close-authentication"] button {display:inline} to control UI element appearance reflecting API capabilities.

Usage

Include the scriptembedded/index.js to your page in the end of <body> tag:

<html>
    <head>
      ...
    </head>
    <body>
      ...
      <script src="[bridge script path]"></script>
    </body>
</html>

Readme

Keywords

none

Package Sidebar

Install

npm i @prescrire/bridge

Weekly Downloads

1

Version

5.0.1

License

MIT

Unpacked Size

21 kB

Total Files

29

Last publish

Collaborators

  • jrivals
  • lichkessel