taskticker

0.0.2 • Public • Published

Install

npm install taskticker

Usage

var taskCreator = require('taskticker'),
    run = taskCreator(),
    stack = taskCreator.stack(),
    count = 0;
 
 
run('count', function(){
    console.log('--'+(++count));
});
 
run('count', function(){
    console.log('--'+(++count));
});
 
stack('first', function(next){
    console.log('--first');
    next();
});
stack('second', function(){
    console.log('--second');
});

The functions are run according to the order they are defined.

Interface

taskCreator(integer milliseconds)

The integer argument is optional with a default of 1000.

var taskCreator = require('taskticker'),
    run = taskCreator(),
    count = 0;
 
 
run('count', function(){
    console.log('--'+(++count));
});
 
run('count', function(){
    console.log('--'+(++count));
});

taskCreator.stack(integer)

Same as taskCreator, but this is the async version.

Calling the next callback in your function calls the next function in the stack.

var taskCreator = require('taskticker'),
    stack = taskCreator.stack(),
    count = 0;

stack('first', function(next){
    console.log('--first');
    //call the second function in the stack.
    next();
});
stack('second', function(){
    console.log('--second');
});

What's taskticker for?

What ever you want to use it for, but testing might be a good idea.

Readme

Keywords

none

Package Sidebar

Install

npm i taskticker

Weekly Downloads

2

Version

0.0.2

License

MIT

Last publish

Collaborators

  • hollowdoor