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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With