Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function eachAsync(collection, iterator, callback) {
- var iterate = function(i) {
- setTimeout(function() {
- iterator(collection[i]);
- if (i < collection.length-1) {
- iterate(i + 1);
- } else {
- if(callback) callback();
- }
- }, 0);
- };
- iterate(0 );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement