I have a tricky situation. I need to delay execution of a function until several functions have completed. While the following would work in a normal situation:
$.when(foo1(), foo2(), foo3()).then(function(){
//foo4();
});
My situation is a little different. I don't want the functions passed to $.when() to execute immediately. foo1-3 will be executed at some point in the near future, by other methods. In other words, I want to execute foo1-3 manually, at a time of my choosing. Only after foo1-3 have executed (in no specific order) will foo4 run.
My intuition told me to dig into $.Deferred(), but I haven't quite found what I need. Any ideas?
.then(foo4), right? Otherwise you're passing the value returned byfoo4()to.then()...