Skip to content

Instantly share code, notes, and snippets.

@zball
Created March 30, 2016 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zball/1b710f50f4bcb4394debec13aea0107e to your computer and use it in GitHub Desktop.
Save zball/1b710f50f4bcb4394debec13aea0107e to your computer and use it in GitHub Desktop.
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