A simple event emitter and listener built in ES6.
eventhub.on('string', handler);
eventhub.on('string', handler);
eventhub.once('string', handler);
eventhub.emit('string', ...args);
eventhub.emit('string');
eventhub.remove('event', handler);
eventhub.remove('string');
import Eventhub from 'eventhub';
const eventhub = new Eventhub();
eventhub.on('text-change', text => {
console.log('Text changed to', text);
});
eventhub.emit('text-change', 'New Text');
or
import Eventhub from 'eventhub';
const eventhub = new Eventhub()
.on('text-change', text => {
console.log('Text changed to', text);
})
.emit('text-change', 'New Text');
MIT