var QueneEnginer = function(){ this.Quene = [];
}
QueneEnginer.prototype = {
processTime : 20,
add : function(fn,context,arrParam){ this.Quene.push(
{
fn : fn,
context : context,
param : arrParam
}
);
},
start : function(){
var that = this;
setTimeout(function(){that.process();},that.processTime);
},
process : function(){
var quene = this.Quene.shift();
if(!quene)return ; quene.fn.apply(quene.context,quene.param);
quene = null;
this.start();
}
}
大家感觉这种实现js事件队列的方式有什么不好的地方 大家有什么其他的方法可以实现事件队列哈 谢谢
}
QueneEnginer.prototype = {
processTime : 20,
add : function(fn,context,arrParam){ this.Quene.push(
{
fn : fn,
context : context,
param : arrParam
}
);
},
start : function(){
var that = this;
setTimeout(function(){that.process();},that.processTime);
},
process : function(){
var quene = this.Quene.shift();
if(!quene)return ; quene.fn.apply(quene.context,quene.param);
quene = null;
this.start();
}
}
大家感觉这种实现js事件队列的方式有什么不好的地方 大家有什么其他的方法可以实现事件队列哈 谢谢
细节代码没有讨论必要