Created
March 30, 2016 20:58
-
-
Save zball/1b710f50f4bcb4394debec13aea0107e to your computer and use it in GitHub Desktop.
Async return value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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