ES7 based event emitter.
npm install tt-event-emitter
import TTEventEmitter from 'tt-event-emitter';
const observable = new TTEventEmitter();
observable.on('sayhello', () => {
console.log('Hello!');
});
// Say 'Hello!' in every 5 seconds.
const helloCycle = window.setInterval(() => {
observable.emit('sayhello');
}, 5000);
// Remove 'sayhello' listener after 20 seconds.
window.setTimeout(() => {
observable.removeListener('sayhello');
window.clearInterval(helloCycle);
}, 20000);
Contributions are welcome. Please clearly explain the purpose of the PR and follow the current style.
Issues can be resolved quickest if they are descriptive and include both a reduced test case and a set of steps to reproduce.
Licensed under the MIT License © Trip-Trax 2015 - present.