@cicada/message

0.3.3 • Public • Published

cicada-message

For cicada iframe post message

NPM version NPM downloads Dependencies

Usage

import createMesssage from '@cicada/message'

const { listen, dispatch, invoke } = createMesssage()

listen('yourMessage', (data) => {
})

dispatch('yourMessage', { data: 'data' })

invoke('yourMessage', { data: 'data' }, 10000).then(result => console.log(result))

API

  • listen(event, callback) 监听事件
  • dispatch(event, data, toParent) 远程触发事件
  • invoke(vent, data, timeout, toParent) 远程服务调用并直接返回

Readme

Keywords

none

Package Sidebar

Install

npm i @cicada/message

Weekly Downloads

7

Version

0.3.3

License

MIT

Unpacked Size

18.7 kB

Total Files

18

Last publish

Collaborators

  • antgod
  • chrisfan
  • chumen.yy
  • gaopeng19960108
  • heatroom
  • imink
  • shaohui.tsh
  • sskyy
  • superraytin
  • xiamidaxia
  • youhan26
  • yubai