@gotoeasy/bus
simple event bus
Install
npm i @gotoeasy/bus
API
const bus = require('@gotoeasy/bus');
bus.on('input', function(txt){
console.log('input ...', txt);
})
bus.once('once', function(txt){
console.log('once ...', txt);
})
bus.at('input', 'abc'); // input ... abc
bus.at('once', '123'); // once ... 123
bus.at('once', '123'); // do nothing
bus.off('input');
bus.at('input', 'abc'); // do nothing
bus.clear(); // clear all events
Links
-
npm-packages
https://github.com/gotoeasy/npm-packages