@anco/eventemitter
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

@anco/EventEmitter

Build Status
An event emitter implementation based on ts and build into es5.

Use Map to minify get time complexity.

How

import EventEmitter from '@anco/eventemitter';
// or
const EventEmitter = require('@anco/eventemitter').default;
const ee = new EventEmitter();
ee.on('sleep',function(...args){
    console.log('sleep triggered, args:', ...args);
})  

ee.emit('sleep','hello1','hello2');
ee.off('sleep');

Implements

  • [x] on
  • [x] off
  • [x] emit
  • [x] once
  • [x] addListeners
  • [x] mutiple callbacks
  • [x] removeAllListeners

WIP

  • [ ] max listeners limitation
  • [ ] some fancy things

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i @anco/eventemitter

    Weekly Downloads

    2

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    12.8 kB

    Total Files

    6

    Last publish

    Collaborators

    • anco