Skip to content

Instantly share code, notes, and snippets.

@zball

zball/asyncExample

Created Mar 30, 2016
Embed
What would you like to do?
Async return value
function getPermissions(){
var permissions = $.Deferred();
FB.api(
"/{{ app.user.facebookID }}/permissions",
{
access_token: '{{ app.user.facebookAccessToken }}'
},
function (response) {
if (response && !response.error) {
permissions.resolve( response );
}
}
);
return permissions.promise();
}
$('a#fb_share_dino').on('click', function(e){
$.when( getPermissions() ).then(
function( status ) {
console.log(status);
}
);
e.preventDefault();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.