How to sync JavaScript callbacks?
The good news is that JavaScript is single threaded; this means that solutions will generally work well with “shared” variables, i.e. no mutex locks are required. If you want to serialize asynch tasks, followed by a completion callback you could use this helper function: function serializeTasks(arr, fn, done) { var current = 0; fn(function iterate() … Read more