1.0.16 • Published 3 months ago
rabbitjs-bridge-gateway v1.0.16
JS Bridge Gateway
JS Bridge Gateway is a bridge tha make JS easily talk to native app and vice versa
Install
yarn
yarn add js-bridge-gateway
npm
npm i js-bridge-gateway
Init Bridge
Make sure window object is not undefined when call init.
Init Option
Prop | Default | Type | Description |
---|---|---|---|
debug | false | boolean | To enable log info in debug mode |
delay | 200 | number | Specify the delay(ms) on register hanlder function |
// root.ts
import JsBridgeCmcb from "js-bridge-gateway";
JsBridgeCmcb.init({ debug: true, delay: 200 });
Usage
Register a handler function so that native app can call
JsBridgeCmcb.registerHandler("hanlderName", (data: any, callback: any) => {
// Do sth...
});
Call handler to native app
const data = await JsBridgeCmcb.callHandler("hanlderName", { param: "fromWeb" });
Set App Bar Title
await JsBridgeCmcb.setToolBarTitle("My Title")
Set App Bar Color
await JsBridgeCmcb.setToolBarColor("#139D61");
Goto Home Screen App
await JsBridgeCmcb.goToHome();
Listen back press event from native app and exit Mini App
JsBridgeCmcb.onBackPressed(async () => {
if (confirm("Do u want to exit?")) {
await JsBridgeCmcb.exit();
}
});
1.0.16
3 months ago
1.0.17-beta.0
3 months ago
1.0.15-beta.3
3 months ago
1.0.15-beta.2
3 months ago
1.0.15-beta.1
3 months ago
1.0.13-beta.2
3 months ago
1.0.15-beta.0
3 months ago
1.0.13-beta.3
3 months ago
1.0.15
3 months ago
1.0.14-beta.0
3 months ago
1.0.14
3 months ago
1.0.13-beta.1
3 months ago
1.0.13
3 months ago
1.0.14-beta.1
3 months ago
1.0.9
3 months ago
1.0.11
3 months ago
1.0.10
3 months ago
1.0.12
3 months ago
1.0.8
3 months ago
1.0.7
3 months ago
1.0.6
3 months ago
1.0.5
3 months ago
1.0.4
3 months ago
1.0.3
3 months ago
1.0.2
3 months ago
1.0.1
3 months ago
1.0.0
3 months ago