Miss any of our Open RFC calls?Watch the recordings here! »

@antv/event-emitter

0.1.2 • Public • Published

@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.

Keywords

none

Install

npm i @antv/event-emitter

DownloadsWeekly Downloads

8,119

Version

0.1.2

License

MIT

Unpacked Size

14.5 kB

Total Files

8

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar