使用频率 | 高 |
所属模块 | Std.queue |
成员类型 | 公有成员函数 |
next方法用于执行当前队列中任务的下一个任务,next方法指定的参数将会作为下一个任务的参数,当队列中任务到头的时候,将会触发complete事件.
同时,执行next的时候,jump事件也会被触发.
Object next(arg1,arg2,arg3,.........);
var queue = new Std.queue([
function(){
setTimeout(function(){
console.log(1)
queue.next()
},500)
},
function(){
setTimeout(function(){
console.log(2);
queue.next();
},500)
}
]);
queue.merge([
function(){
var that = this;
setTimeout(function(){
console.log(3);
that.next();
},200)
},
function(){
var that = this;
setTimeout(function(){
console.log(4);
that.next();
},200)
}
]);
queue.start();