Reputation: 1800
I just cannot get my head around deferred objects
dfd = new $.Deferred();
FB.api('/me/posts?fields=id,story&access_token='+accessToken,function(response){
dfd.resolve();
//Do something with the result
});
dfd.done(alert(dfd.isDeferred()));
From my understanding the .done
should only fire once the request is completed and the callback sets the object as resolved, however the alert box is firing false before the request completes.
What am I missing?
Upvotes: 5
Views: 1906
Reputation: 47986
Try changing the last line of code to :
dfd.done(function(){ alert(dfd.isDeferred()); });
This is how the use of the done()
function is documented in the jQuery API
Upvotes: 6