Skip to content

Commit

Permalink
Update seqexec.js
Browse files Browse the repository at this point in the history
add line end
  • Loading branch information
xiehe authored Jan 15, 2019
1 parent c14c6f4 commit 0f1f7e1
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions seqexec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var seqexec = {
config: {
time: 200, // 每隔200毫秒检测一次
// steps: 2 // 共有要执行2步骤
time: 200 // 每隔200毫秒检测一次
},
close: false, // 关闭检测
stepDone: 0, // 当前完成的步骤
Expand All @@ -10,21 +9,21 @@ var seqexec = {
when: function(fn) {
let step = 1;
this._fns[step] = fn;
return this
return this;
},
then: function(fn) {
let step;
for (i in this._fns) {
step = i;
}
this._fns[parseInt(step)+1] = fn;
return this
return this;
},
// 处理执行,定期检测
start: function() {
let step = 1;
this._runAndDetect(step);
return this
return this;
},
next: function() {
// 是否有下一步未执行的函数
Expand All @@ -33,13 +32,13 @@ var seqexec = {
step = i;
}
if (this.stepDone >= step) {
return this
return this;
}
this._runAndDetect(parseInt(this.stepDone) + 1);
return this
return this;
},
_runAndDetect: function(step) {
let ths = this
let ths = this;
// 执行第一个函数
this._fns[step](step);
// 定时检测执行状态
Expand Down

0 comments on commit 0f1f7e1

Please sign in to comment.