Getting Started
Following example demonstrates a sequence that divides an integer by 10, then 5:
const _t = require('robo-toolkit').task;
var initialValue = 100;
_t.seq(
_t.async((task, args) => {
console.log('first task started with arguments: ' + args);
task.complete(args / 10);
}),
_t.delayWait(
_t.async((task, args) => {
console.log('second task started with arguments: ' + args);
task.complete(args / 5);
})
)
)
.on('completed', e => {
console.log('sequence completed. Final result: ' + e.sender.getResult());
})
.start(initialValue);
The output in console looks like:
first task started with arguments: 100
second task started with arguments: 10
sequence completed. Final result: 2
Last updated