@likg/bus
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

lg-bus

类似于eventBus,使用发布订阅者模式实现事件分发中心。

安装

$ npm i lg-bus
# OR
$ yarn add lg-bus

导入

import Bus from 'lg-bus';

使用

// 1. 添加事件
Bus.$on(事件名称, 事件处理函数);
// 2. 触发事件
Bus.$emit(事件名称, 参数1[, 参数2, 参数3...]);
// 3. 移除事件
Bus.$off(事件名称, 事件处理函数);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    2

Package Sidebar

Install

npm i @likg/bus

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

4.22 kB

Total Files

8

Last publish

Collaborators

  • lihongyao