Introduction
Tasks
var Task = require('taskgroup').Task
// Create a task for our synchronous function
var task = new Task(function () {
// Do something ...
return "a synchronous result"
// You can also return an error
// return new Error("something went wrong")
})
// Add our completion callback for once the task has completed
task.done(function (err, result) {
// Do something now that the task has completed ...
console.log([err, result])
/* [null, "a sychronous result"] */
})
// Execute the task
task.run()TaskGroup
Nested TaskGroups
Handling Errors
Notes
Promise Style Mistakes
Legacy Environments
Graduation
Last updated
Was this helpful?