# meet-bridge

> The Bridge for MEET.ONE Client

Latest version **2.2.0** (published 2020-06-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install meet-bridge
pnpm add meet-bridge
yarn add meet-bridge
bun add meet-bridge
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2020-06-15 |
| First published | 2018-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=6.0.0 |
| Dependencies | 0 |
| Unpacked size | 65.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | JohnTrump |
| Maintainers | wujunchuan1994 |

## Links

- npm: https://www.npmjs.com/package/meet-bridge
- Repository: https://gitlab.com/meetone/meet-bridge
- npm.io page: https://npm.io/package/meet-bridge

## Recent versions

- 2.2.0 (latest) — 2020-06-15
- 2.1.2 — 2019-08-22
- 2.1.1 — 2019-07-08
- 2.1.0 — 2019-06-13
- 2.0.2-release — 2018-12-07
- 1.0.11 — 2018-09-12
- 1.0.10 — 2018-09-10
- 1.0.9 — 2018-09-07
- 1.0.8 — 2018-08-31
- 1.0.7 — 2018-08-27
- 1.0.6 — 2018-08-22
- 1.0.5 — 2018-08-22
- 1.0.4 — 2018-08-22
- 1.0.3 — 2018-08-16
- 1.0.2 — 2018-08-10
- … 2 more at https://npm.io/package/meet-bridge/versions

## README

# meet-bridge(Discarded)

[![npm version](https://badge.fury.io/js/meet-bridge.svg)](https://badge.fury.io/js/meet-bridge)
[![js deliver](https://data.jsdelivr.com/v1/package/npm/meet-bridge/badge)](https://www.jsdelivr.com/package/npm/meet-bridge)

This Project is discarded now, we strong recommend use [meet-js-sdk](https://www.npmjs.com/package/meet-js-sdk)

## Introduction

The Bridge Library for Meet.ONE Client

This library is used to assist to generating the protocol URI of the client, and encapsulates some common protocols and methods.

[API Docs](https://meet-common.gitlab.io/fe/meet-bridge/)

[Live Demo@1.x.x](https://meet.one/test/index.html)

[Live Demo@2.x.x](https://meet.one/test/index@2.html)

## How to invoke protocol - Promise callback styles (Version >= 2.0.0)

Library will support Promise callback styles code after `2.0.0` or later.

The following is an example of how to invoke protocol to ask for authorize.

```js
var bridge = new MeetBridge() // 1. Creates an instance of Bridge.

bridge
  .invokeAuthorizeInWeb()
  .then(function(result) {
    // handler success
    console.log(result)
  })
  .catch(function(error) {
    // handler error
    console.error(error)
  })
```

## How to generate protocol uri (Version < 2.0.0)

The following is an example of how to generate protocol uri to ask for authorize

```js
var bridge = new MeetBridge() // 1. Creates an instance of Bridge.

// 2. generate autorize protocol uri
var uri = bridge.invokeAuthorize({
  scheme: 'moreone', // the callback of protocol scheme
  redirectURL: 'http://more.one', // When callback failed (eg.protocol doesn't response) will redirect to URL(common like dapps' homepage)
  dappName: 'MORE.ONE', // Dapps' name
  dappIcon: 'https://static.ethte.com/more/images/icon/icon60pt.png', // Dapps' icon URL
  loginMemo: 'The EOS Candy Box'
})

// 3. After the protocol URI address is generated, the web terminal can communicate with the client through the following two calling methods.
window.location.href = uri
window.postMessage(uri)
```

## How to receive message from client (Version < 2.0.0)

Receiving and parsing the things returned by the client can be achieved by listening to the `Message` event.

```js
window.document.addEventListener('message', function(e) {
  const message = e.data // receive original message
  document.getElementById('receive').innerHTML = messgae

  // can also be directly converted to an Object using `Bridge.revertParamsToObject(params)`;
  const { params } = JSON.parse(message)
  document.getElementById('decode').innerHTML = decodeURIComponent(atob(params))
})
```

## CHANGELOG

执行 npm update meet-bridge 升级库

- v2.2.0

  - 无

- v2.1.0
  1.  初始化 meet-bridge 进行判断,避免重复监听 message 事件
  2.  支持多次回调的协议生成方法
  3.  支持自定义 webview 右上角标题及点击事件回调

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