1.0.6 • Published 10 years ago

execq v1.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

###execQ

pending the commands and execute them in a right time.

used in project RocketEngine

####Install

npm install execq

####Usages

var execQ = new require('execq');

execQ.pend([socket, socket.write, argv]);
execQ.pend([socket, socket.write, argv]);
execQ.pend([socket, socket.write, argv]);
execQ.pend([socket, socket.write, [arg1, arg2...]]);
execQ.pend(function(){ // the codes });

// once some important jobs done
worker.on('works done', function () {
  // now go on execute the pended codes remain in queue
  execQ.goon();
});

####API

// init the max pending-queue lenght
var execQ = new require('exdecq')(maxlen);

maxlen default to 1000

// get pending queue's length
execQ.length // => x
// add a job to pending-queue
execQ.pend(operation);
  • operation {Array | Function}

ex:

// array
[object, function, [arg1, arg2, ..., argn]]
// execute a series of pended commands with a seqnum
execQ.goon(seqnum);

execute the commands from the seqnum

  • seqnum {Number} (option)
// clean the pending-queue
execQ.clean();

execQ will emit event pending on invoking .pend(), and emit event continue on finish invoking .goon()

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago