@antv/event-emitter
event emitter for antvis.
Last updated 5 years ago by zqlu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install @antv/event-emitter 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.1.3                                ...           latest (3 years ago)

4 Versions

  • 0.1.3                                ...           3 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (8)

Copyright 2013 - present © cnpmjs.org | Home |