Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoazhen committed Aug 25, 2012
1 parent 6431792 commit 4d2dde7
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions jumper.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,23 @@
this.index = -1;
this.steps=[];

this.add.apply(this, arguments);
if(arguments.length > 0){
this.add.apply(this, arguments);
}

this.go = _.bind(this.go, this);
this.back = _.bind(this.back, this);
this.action = _.bind(this.action, this);
this.jump = _.bind(this.jump, this);
this.onceInAll = _.bind(this.onceInAll, this);
this.once = _.bind(this.once, this);

};

var _createTaskInProcess = function(process, taskName, func){
if(process && !process.tasks){
process.tasks=[];
}

// var task = _createTask();
// task.func = func;
// process.tasks.push(task);

var task = _.find(process.tasks, function(item){
return item.taskName === taskName;
});
Expand Down Expand Up @@ -154,9 +152,9 @@
};
// Jump to special process with index
p.jump = function(index){
if(index >-1 && index < this.steps.length){
index--;
if(index >= -1 && index < this.steps.length){
this.index = index;
this.action.apply(this, slice.call(arguments, 1));
}
return this;
};
Expand Down

0 comments on commit 4d2dde7

Please sign in to comment.