Skip to content

Instantly share code, notes, and snippets.

@michiel
Created September 30, 2010 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michiel/604730 to your computer and use it in GitHub Desktop.
Save michiel/604730 to your computer and use it in GitHub Desktop.
var BLOCKSIZE = 500;
var dataset = []; // Assuming, of course, that there's something in here..
var renderActions = [];
for (var i=0; i<dataset.length; i+= BLOCKSIZE) {
renderActions.push((function(offset) {
return function(callback) {
//
// Perform rendering here using dataset[offset] to start
//
setTimeout(callback, 1); // Release control
}
})(i)); // 'i' gets pulled into the new scope as 'offset'
}
var sequencer = new Sequencer(renderActions);
sequencer.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment