evented-async
Event-based extensions for the Node.js async library
Installation
npm install evented-async
timer()
Instruments an async function so it emits timing values when the async callback is called.
Example
{ ;} emitter = ;emitter; timedTask = eventedAsync;;
profile()
Syntactic sugar for the timer
function. profile
will apply arguments to an async function and emit timing events, eliminating the need to pass a wrapper function to timer
.
Example
{ ;} emitter = emitter; eventedAsyncprofileemitter 'timeToSlowAdd' slowAdd 5 6;
Queue class
An event-driven wrapper for async.queue
. There are two major differences in semantics:
- The
push
andunshift
methods take a standard comma-separated list of arguments, rather than an object that maps argument names to argument values. These methods do not accept callbacks, nor do they support adding multiple tasks at once. - The queue emits events for the 'saturated', 'empty', and 'drain' callbacks.
Example
q = { ;}; q; q;q;