0.0.4 • Published 10 years ago

eventseries v0.0.4

Weekly downloads
12
License
-
Repository
-
Last release
10 years ago

eventseries

Serialise a series of asynchronous events which you'd normally prefer to have synchronous but can't afford to block.

Have you ever wanted to run a function on an array of objects and tried something like:

array.forEach(function(o) { console.log(o); });

and noticed that they're not guaranteed to be in order?

require('eventseries');

var exptSequence = new eventseries({
   'order'  : ['fred','betty','barney','wilma'], /* the sequence in which to fire named callbacks */

   'callbacks' : {
       /* Named callbacks.
          Each is passed the sequence object.
          Each should call next() when finished */

       'fred'   : function(seq) { console.log("one");   seq.next(); },
       'betty'  : function(seq) { console.log("two");   seq.next(); },
       'barney' : function(seq) { console.log("three"); seq.next(); },
       'wilma'  : function(seq) { console.log("four");  seq.next(); }
   }
});
0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago