Created
February 4, 2011 00:01
-
-
Save cloudhead/810487 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function process(items, callback) { | |
(function iterate(list) { | |
var item = list.shift(); | |
if (item) { | |
process.nextTick(function () { | |
iterate(list); | |
}); | |
} else { | |
callback('done!'); | |
} | |
})(items.slice(0)); | |
} | |
process(array, callback); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment