2.3.5 • Published 2 years ago

@taikonauten/event-emitter v2.3.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Event-emitter is a wrapper library to abstract access to underlying event emitter libraries. In this case EventEmitter3 is used.

The benefit of using this library is to be able to quickly replace the event emitter implementation without changing the signature of existing code.

Installation

npm install --save @taikonauten/event-emitter

Usage

import emitter from '@taikonauten/event-emitter';

const callback = (params) => {
  console.log('test-event fired with params', params);
});

// add a listener
emitter.addListener('test-event', callback);

const testData = {
    message: 'success',
    event: 'test-event',
};

// emit the event
// result: test-event fired with params {message: 'success', event: 'test-event'}
emitter.emit('test-event', testData);

// remove the listener at any time
emitter.removeListener('test-event', callback);

Made with ♡ at Taikonauten

2.3.4

2 years ago

2.3.5

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

2.3.3

2 years ago

2.3.0

2 years ago