node-stepify
node-stepify copied to clipboard
为什么 我的这个task没有运行。
var workflow = Stepify().debug(true);
workflow
.task('t1')
.step('t1s1', function(){
var root = this;
setTimeout(function(){
console.log('this is t1s1');
root.done(null, 'i am from t1s1');
}, 500);
})
.step('t1s2', function(a, b){
var root = this;
setTimeout(function(){
console.log('this is t1s2');
console.log('t1s2 arg a: '+a);
console.log('t1s2 arg b: '+b);
},500);
}, 'i am from t1s2')
.task('t2')
.step('t2s1', function(){
console.log('this is t2s1');
})
.run(['t1','t2']);
输出是:
app is running at port 3000
Task: t1 added.
Task: t2 added.
Start to run task: t1.
Start to run task: t2.
Start to run step: t1s1.
Start to run step: t2s1.
this is t2s1
this is t1s1
The step: t1s1 has done.
Start to run step: t1s2.
this is t1s2
t1s2 arg a: i am from t1s2
t1s2 arg b: i am from t1s1
但是没有输出 t2s1 这是为什么?
找到原理了,每个step都要调用 this.done() 或者 this.next() 。 对吧?
对的,表示你已经完成一部操作了
谢谢~
哈哈 有问题随时交流哈
还有一个issues,啥时候回复一下。。。 https://github.com/chemdemo/node-stepify/issues/4