event-emitter-for-web
v1.1.2
Published
Simple web Event emitter
Downloads
1
Maintainers
Readme
let EEW = new EventEmitterWeb();
setTimeout(()=>{
EEW.emit("cb",{data:"My Data"});
EEW.emit("cb2",{data:"My Data"});
},5000);
EEW.on("cb",data=>{ console.log(data); })
EEW.on("cb2",data=>{ console.log(data); })
EEW.onAll((data,name)=>{
`console.log("EVENT WILL BE FIRED FOR EVERY EMIT");`
`console.log(data);`
})
EEW.once((name,data)=>{
`console.log("EVENT WILL BE FIRED ONCE AND WILL BE REMOVED FROM EVENTS");`
})
EEW.clearAllEvents()
EEW.clearEventByName('cb')