Created
March 9, 2015 09:31
-
-
Save darrylhebbes/35b7c9fd500c2201d4e7 to your computer and use it in GitHub Desktop.
#Javascript : Delay Facebook init
This file contains hidden or 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
| .run(function($rootScope, $location, SlidebeanUser) { | |
| // 1) AngularJS app is now running | |
| // 2) Initialize Parse and set the current user to the $rootScope | |
| Parse.initialize("parse app", "parse credentials"); | |
| $rootScope.sessionUser = SlidebeanUser.current(); | |
| // 3) Finally, init Facebook | |
| window.fbAsyncInit = function() { | |
| Parse.FacebookUtils.init({ | |
| appId: 'facebook app id', | |
| channelUrl : '//www.slidebean.com/fbchannel.html', | |
| status: true, | |
| cookie: true, | |
| xfbml: true | |
| }); | |
| }; | |
| (function(d, s, id){ | |
| var js, fjs = d.getElementsByTagName(s)[0]; | |
| if (d.getElementById(id)) {return;} | |
| js = d.createElement(s); js.id = id; | |
| js.src = "//connect.facebook.net/en_US/all.js"; | |
| fjs.parentNode.insertBefore(js, fjs); | |
| }(document, 'script', 'facebook-jssdk')); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment