Skip to content

builify/tt-event-emitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tt-event-emitter

Build Status Coveralls Status Code Climate NPM Version

ES7 based event emitter.

Installation

npm install tt-event-emitter

Usage

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 & Issues

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.

Licence

Licensed under the MIT License © Trip-Trax 2015 - present.