timedqueue

0.1.0 • Public • Published

A generic object queue with timeout calculated as num_obj_in_the_queue*millisec, emitting flush event when timeout is fired Subscribe to "flush" event to get notified when the queue needs to be emptied. Invoke terminate() method to unsubscribe and delete the queue, after emptying.

Usage:

var myqueue = new TimedQueue({id:"myqueueid", interval:500, multiplier:1000,debug:true}); // debug parameter is optional myqueue.on("flush", function(flushed) { console.log("received flush array: " + JSON.stringify(flushed)); });

myqueue.push("msg1"); // you can push any object type

setTimeout(function(){ myqueue.terminate(); }, 10000);

Readme

Keywords

none

Package Sidebar

Install

npm i timedqueue

Weekly Downloads

0

Version

0.1.0

License

BSD

Last publish

Collaborators

  • gecko