@prescrire/bridge v5.0.1
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>