ds-events
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

介绍

  1. ds3系列第一个开发库,主要功能是一个简单的eventbus库,
  2. 特色功能:可以加入自己函数,类似rxjs的操作符
  3. 使用vite构建

使用

安装

1. npm i ds-events

使用

  1. 示例一

import { DsEventBus } from 'ds-events';
import { debounceTime } from 'ds-events/dist/types/plugins';  // 未来需要修改

const ev = new DsEventBus();
const sub = ev.pipe(debounceTime(500)).on('test', (a) => {
    console.log(a);
})
ev.emit('test', '这是发送的数据');
ev.emit('test', '这是发送的数据2');
ev.remove('test' ,sub);
ev.emit('test', '这是发送的数据3');

结果: 
这是发送的数据2

Readme

Keywords

Package Sidebar

Install

npm i ds-events

Weekly Downloads

0

Version

0.0.3

License

none

Unpacked Size

8.54 kB

Total Files

14

Last publish

Collaborators

  • fbdong