Created
August 16, 2011 02:34
-
-
Save jiggliemon/1148329 to your computer and use it in GitHub Desktop.
A Better way to handle window.fbAsyncInit
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
/* | |
Requires: | |
- Events: https://gist.github.com/884484 | |
- Extend: https://gist.github.com/1049896 | |
- Namespace: https://gist.github.com/1006005 | |
*/ | |
SML = Object.namespace('SML',new Events); | |
window.fbAsyncInit = function(){ | |
FB.init({ | |
appId: 'your app id', | |
status: true, | |
cookie: true | |
}); | |
SML.fireEvent('FB.ready:latched'); | |
}; | |
SML.addEvent('FB.ready',function(){ | |
FB.api('/me', function(response) { | |
console.log(response); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment