I have an API that returns a promise from a deferred object.
The problem is that the caller is supposed to behave synchronously. As an option to present to the team, how would I make the calling function behave synchronously?
var foo = function() {
var promise = returnsPromise();
promise.done().fail();
// insert magic here
// function returns when either done() or fail() is completed.
}
If you really need to wait for the deferred to resolve at that point, just do exactly that as you would do it without jQuery: