Skip to content

Latest commit

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

EventMonger is a dead simple event system.

I didnt like a lot of the syntax for classical event system, so presto.

var{ Event, emit, on, off, once, when, clear }=require('eventmonger')// orimport{Event,emit,on,off,once,when,clear}from'eventmonger'letsampleEvent=Event()letcallback=name=>console.log("hello ",name,"!")// register a callback on an event// note: returns the callbackon(sampleEvent,callback)// remove a callback from an event// note: returns the callbackoff(sampleEvent,callback)// once will return a promise that will resolve once the event if firedonce(sampleEvent).then(data=>console.log(data))// fire off the event!// note: events can only have one paramteremit(sampleEvent,"world")// you can use 'when' to filter a callback!on(sampleEvent,when(name=>name=="world",name=>console.log("hello world")))// you can use clear, to well, clear all the callbacks from an Event// note: returns the eventclear(sampleEvent)

About

a dead simple event system

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages