You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
4 months ago | |
|---|---|---|
| .. | ||
| esm | 4 months ago | |
| lib | 4 months ago | |
| src | 4 months ago | |
| README.md | 4 months ago | |
| package.json | 4 months ago | |
README.md
@antv/event-emitter
event-emitter for @antvis.
Install
npm i --save @antv/event-emitter
Usage
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');
API
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.