@wii/raven
TypeScript icon, indicating that this package has built-in type declarations

2.14.2 • Public • Published

Raven

Raven - protocol above postMessage

Install

npm i @wii/raven

Usage

import Raven from '@wii/raven';

// 父应用
const raven = new Raven({
  // iframe 容器节点
  container: '#iframe-container',
  // iframe 地址
  src: 'http://example.com',
  // 需要传递给 iframe 的额外参数,以 search 方式传递
  params: {},
});

// 子应用
const raven = new Raven();

API

  • send('messageName', message): 发送消息
  • subscribe('messageName', handler): 监听消息
  • broadcast('messageName', message): 广播消息
  • destroy(): 销毁实例

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @wii/raven

      Weekly Downloads

      0

      Version

      2.14.2

      License

      MIT

      Unpacked Size

      37.4 kB

      Total Files

      10

      Last publish

      Collaborators

      • leo_
      • jerryjchen
      • chanceyliu
      • kagawa
      • jasonngao
      • qinmudi
      • wenyan0202
      • wongjorie