I'm sick of the following problem:
I am requesting the Facebook API for some permissions using the facebook function FB.api() . I want to wait for the result of this before I continue with some tests, etc. My goal is to create a small helper class to call commonly used functions with this class:
var fbHelper = { hasPermission: function(permission) { var hasPermission = false; var requestedPermissions = false; var permissions = { }; FB.api('/me/permissions', function(response){ permissions = response; requestedPermissions = true; return response; }); if(permissions){
So, I want to use fbHelper.hasPermission('dummy') . Unfortunately, if(permissions) works until the completion of FB.api() . How can I wait for the rest of my code to complete Api-Call?
Denis source share