# web-bridge-gateway

> web bridge gateway is bridge communication between native and webview.

Latest version **1.0.5** (published 2023-02-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install web-bridge-gateway
pnpm add web-bridge-gateway
yarn add web-bridge-gateway
bun add web-bridge-gateway
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2023-02-02 |
| First published | 2023-02-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | din.lyhor |
| Keywords | web-bridge-gateway |

## Links

- npm: https://www.npmjs.com/package/web-bridge-gateway
- npm.io page: https://npm.io/package/web-bridge-gateway

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2023-02-02
- 1.0.4 — 2023-02-02
- 1.0.3 — 2023-02-02
- 1.0.2 — 2023-02-02
- 1.0.1 — 2023-02-02
- 1.0.0 — 2023-02-02

## README

# Web Bridge Gateway

Web-Bridge-Gateway is a wrapper of **WebviewJavascriptBridge**
<br />
<br />

## Install

_yarn_

```bash
yarn add web-bridge-gateway
```

_npm_

```bash
npm i web-bridge-gateway
```

<br />

## Configurations (Options)

| Key     | Type    | Default | Description                                                                                                       |
| ------- | ------- | ------- | ----------------------------------------------------------------------------------------------------------------- |
| _delay_ | Number  | `200`   | The processing of registerHandler failure caused by birdge initialization takes time, delay call time, value `ms` |

<br />

## Methods

1.  `callHandler`
    <br />
    <br />
    - **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.
      <br />
      <br />
    ```js
    import { callHandler } from 'web-bridge-gateway'

    callHandler("setBarTitle", { title: "Home Page" })
      .then(() => {
        // do something
      })
      .catch(() => {
        // handle error
      });
    ```


2.  `registerHandler`
    <br />
    <br />
    - **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).
      <br />
      <br />
    ```js
    import { registerHandler } from 'web-bridge-gateway'

    registerHandler("myListener", (data, callback) => {
      console.log("data from native:", data);
      callback('callback to native');
    });
    ```

<br />

## Links

[Mini app boilerplate](https://github.com/ABA-Bank/mini-app-boilerplate)

---
_Source: https://npm.io/package/web-bridge-gateway · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
