singleton-event-emitter
v0.0.1
Published
A singleton instance of node EventEmitter. If it is required in multiple node packages, it will return the same instance of EvenetEmitter.
Downloads
2
Maintainers
Readme
singleton-event-emitter
A singleton instance of node EventEmitter. If it is required in multiple node packages, it will return the same instance of EvenetEmitter. Can be used to emit global debug events.
Installation
npm install singleton-event-emitter
Usage
// emitter.js
const singletonEvenetEmitter = require('singleton-evenet-emitter');
singletonEvenetEmitter.emit('someEvent')
// listener.js
const singletonEvenetEmitter = require('singleton-evenet-emitter');
singletonEvenetEmitter.on('someEvent', () => {
console.log("someEvenet");
})