0.18.0 • Published 5 years ago
global-wait v0.18.0
If you want to start multiple asynchronous processes from different places and then wait for them all to finish, global-wait can help.
Create a ticket that everyone else will wait on:
var ticket = wait.start("pack up")
Then various people can wait for things to finish:
wait(dontStray)
When you are done with your ticket, mark it finished:
wait.finish(ticket)
And then your callback will be called:
function dontStray() {
console.log("They don't love you like i love you.")
}
If you want to wait on things to be finished in a different iframe:
wait.forIframe(".my-iframe", function() {
console.log("my frame finished!")
})