hoook
hoook is an event emitter with async and priority support.
Since hoook works a bit differently compared to "normal" event emitters
the methods are named fire
, hook
and unhook
instead of the known emit
, on
and off
.
Usage
var hoook = ; // create a new objectvar ee = ; // hook with priority 50.// higher priorities will run first.ee; // by default the priority is 100.// higher priority hooks will run// before lower ones.ee; // if the callback has two or more// arguments it is considered an// async hook.ee; // the middleware-chain can be abortedee; // ...or you can abort it with an erroree; // emitting an event is as easy asee; // pass in a callback which will be// called once the callback chain has finishedee; // defining the ev object goes like this:ee; // remove all hooks listening to 'foo'ee; // remove a specific hookee; // remove all hooksee;
Installation
npm install hoook
License
MIT