Skip to content

Instantly share code, notes, and snippets.

@hatched

hatched/patch.js Secret

Created August 16, 2013 19:04
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 hatched/118a91ba19be71bde4f2 to your computer and use it in GitHub Desktop.
Save hatched/118a91ba19be71bde4f2 to your computer and use it in GitHub Desktop.
This will throttle add unit's replace the lines 196 to 198 in inspector.js with this:
// XXX REMOVE ME - I'm only here to throttle unit creation to test UX
var self = this;
for(var j = 0; j < delta; j+=1) {
setTimeout(function() {
console.log('settimeout');
// Keep me but swap self for this and 1 to delta
env.add_unit(
service.get('id'), 1,
Y.bind(self._addUnitCallback, self));
}, j * 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment