This fires twice, unexpectedly:
function all(){
var promise = make_promise();
// Simulate async call from some source
setTimeout(function(){
promise.fulfill(fixture);
}, 3000);
return promise;
}
This fires just once, as expected:
function all(){
var promise = make_promise();
// Simulate async call from some source
function fulfill(){
promise.fulfill(fixture);
}
setTimeout(fulfill, 3000);
return promise;
}
Attempting to use global functions didn't work either for me.
I suggest using Doug Crockfords "once" on the function - if you in fact only need to use it once.
http://gist.github.com/373144
If the issue is that the function shouldn't be called twice before the first finishes, you can adapt it.
Feel free to pop in #ujsug (IRC) or send a message to our google group if you want to discuss the issue.