An event loop abstraction.
Install
$ npm install --save voltrevo-event-loop
Usage
At the moment, this package basically implements setTimeout
without using the global event loop. Control is given to you in the form of .run()
and .runNext()
.
var EventLoop = ; var el = ; el; el; el; // No output yet el; // bel; // cel; // a // Or use el.run() to keep running until no events are left.
.run()
will run all tasks that it can possibly see, which includes tasks that get added during .run()
. It doesn't just run the tasks that have been posted before the call.
el; el; el; // No output yet el; // b, c, a
License
MIT © Andrew Morris