Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. function splitLoop(items, process, context, callback) {
  2. var todo = items.concat();
  3. setTimeout(function () {
  4. var start = +new Date();
  5. do { process.call(context, todo.shift());
  6. }
  7. while (todo.length > 0);
  8. if (todo.length > 0) {
  9. setTimeout(arguments.callee, 25);
  10. } else {
  11. callback(items);
  12. }
  13. }, 25);
  14. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement