co-tasks
Task or hook runner using co. Runs an array of tasks in series.
.run([tasks], [ctx], [args], [timeout])
var TaskRunner = ;var taskRunner = ; // Add taskstaskRunner; taskRunner; taskRunner; taskRunner; taskRunner; // Call tasks taskRunner; // You'll see, pre-* and post-* tasks will be calling as well// Output StartFoo oneFoo twoAfter fooFinish
.pipe([tasks], [ctx], pipeObj, [timeout])
Runns tasks in series, pipes pipeObj
through all tasks in series
tasks
Task names, this can be optional if allowedTasks option is set.
ctx
This context
pipeObj
Pipe through object
timeout
Timpout in milliseconds. Defaults to 30000
yieldables
We call yieldable a function, a generator or a promise, supported by co-task.
Promises
taskRunner
Generators
taskRunner
Callback functions
taskRunner
Callbacks with promises
taskRunner
Promise returning functions
taskRunner
Call it all together
taskRunner;
Arguments and this context
Passing arguments or a this context to yieldable is very easy. co-tasks accepts a this context as second parameter and an arguments array as third parameter. Both of them are optional.
let ctx = prefix: '#'; let args = 'apple' 'banana'; taskRunner; taskRunner; ;
Timeout
co-tasks timeouts after 30 seconds by default. The timeout can be changed by passing a number of milliseconds as fourth or last parameter
var promise = ;