@fle-tools/pm
TypeScript icon, indicating that this package has built-in type declarations

2.0.7 • Public • Published

@fle-tools/pm

Based Post Message

Installation

Install via your package manager

npm i @fle-tools/pm

# or

yarn add @fle-tools/pm

Usage

// 父应用
import PM = from '@fle-tools/pm';

const Message = new Message({
  targetOrigin: '*',
  isLogger: true,
})

Message.emit({
  type: 'ADD_TODO',
  payload: {
    test: 'test'
  }
});

Message.on('ADD_TODO', (payload) => {
  console.log(payload);
});

Message.destroy();

子应用

API

参数名 必填 类型 默认值 备注
iframeId false string fle_pm__Iframe iframeId
identity true 'parent'|'child' 'parent' 当前所处身份 是父应用 还是子应用
host true string '‘ 应用host。

Action

事件名 必填 类型 备注
on false function 监听message
emit false function 发送message
destroy false function 销毁message监听

Readme

Keywords

none

Package Sidebar

Install

npm i @fle-tools/pm

Weekly Downloads

0

Version

2.0.7

License

MIT

Unpacked Size

16.2 kB

Total Files

11

Last publish

Collaborators

  • libin_pro
  • chenfangsheng