Skip to content

Instantly share code, notes, and snippets.

@darrylhebbes
Created March 9, 2015 09:31
Show Gist options
  • Select an option

  • Save darrylhebbes/35b7c9fd500c2201d4e7 to your computer and use it in GitHub Desktop.

Select an option

Save darrylhebbes/35b7c9fd500c2201d4e7 to your computer and use it in GitHub Desktop.
#Javascript : Delay Facebook init
.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