|
|
1 年之前 | |
|---|---|---|
| .. | ||
| esm | 1 年之前 | |
| lib | 1 年之前 | |
| src | 1 年之前 | |
| README.md | 1 年之前 | |
| package.json | 1 年之前 | |
event-emitter for @antvis.
npm i --save @antv/event-emitter
import EE from '@antv/event-emitter';
const ee = new EE();
ee.on('mouseover', () => {});
ee.once('click', () => {});
ee.on('*', () => {});
ee.emit('click', 1, 'hello', true);
ee.off('click');
Simple and similar with event-emitter.
on(evt: string, callback: Function): listen an event.once(evt: string, callback: Function): listen a event only once.emit(evt: string, ...parameters: any[]): emit / trigger an event with parameters.off(evt?: string, callback?: Function): unsubscribe an event.getEvents(): get all the exist events.