EventEmitter
const energy = require("energy")
const emitter = energy()
Or use new
if you prefer. Either way works :)
const energy = require("energy")
const emitter = new energy
energy()
objectemitter.on(event, listener)
emitter.off(event?, listener?, quota?)
.off()
removes all listeners for all events.off(event)
removes all event listeners.off(event, listener)
removes all occurrences of event listener.off(event, listener, quota)
remove quota occurrences of event listeneremitter.emit(event, ...args)
emitter.once(event, listener)
emitter.clone()
emitter.listeners(event)
emitter.init()
emitter.to(target)
emitter
as the source.energy.to(target)
energy()
object as the sourceWorks in node and in any browser. Tested in node, Chrome, FF, Opera, IE8