Revision: 46556
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 21, 2011 05:34 by karmacode
Initial Code
//Copyright 2009 Nicholas C. Zakas. All rights reserved.
//MIT Licensed
function timedChunk(items, process, context, callback){
var todo = items.concat(); //create a clone of the original
setTimeout(function(){
var start = +new Date();
do {
process.call(context, todo.shift());
} while (todo.length > 0 && (+new Date() - start < 50));
if (todo.length > 0){
setTimeout(arguments.callee, 25);
} else {
callback(items);
}
}, 25);
}
Initial URL
http://www.nczonline.net/blog/2009/08/11/timed-array-processing-in-javascript/
Initial Description
Initial Title
improved timed chunk javascript function
Initial Tags
Initial Language
JavaScript