1.0.5 • Published 1 year ago

web-bridge-gateway v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Web Bridge Gateway

Web-Bridge-Gateway is a wrapper of WebviewJavascriptBridge

Install

yarn

yarn add web-bridge-gateway

npm

npm i web-bridge-gateway

Configurations (Options)

KeyTypeDefaultDescription
delayNumber200The processing of registerHandler failure caused by birdge initialization takes time, delay call time, value ms

Methods

  1. callHandler

    • description: Communicate between native app and mini app. The first parameter is the name provided by native app, the second parameter (optional) is the request body.
    import { callHandler } from 'web-bridge-gateway'
    
    callHandler("setBarTitle", { title: "Home Page" })
      .then(() => {
        // do something
      })
      .catch(() => {
        // handle error
      });
  1. registerHandler

    • description: Register a handler for listening to native app call. The first parameter a name that will be provided by native app, the second parameter is a callback function (optional).
    import { registerHandler } from 'web-bridge-gateway'
    
    registerHandler("myListener", (data, callback) => {
      console.log("data from native:", data);
      callback('callback to native');
    });

Links

Mini app boilerplate

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago