1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 09:50:31 +01:00
onion/js/third_party/facebook_handler.js

40 lines
1.1 KiB
JavaScript

'use strict';
import { altThirdParty } from '../alt';
import EventActions from '../actions/event_actions';
import FacebookActions from '../actions/facebook_actions';
import AppConstants from '../constants/application_constants'
class FacebookHandler {
constructor() {
this.loaded = false;
this.bindActions(EventActions);
this.bindActions(FacebookActions);
}
onApplicationWillBoot(settings) {
// Callback function that FB's sdk will call when it's finished loading
// See https://developers.facebook.com/docs/javascript/quickstart/v2.5
window.fbAsyncInit = () => {
FB.init({
appId: AppConstants.facebook.appId,
// Don't parse anything on the first load as we will parse all XFBML components as necessary.
xfbml: false,
version: 'v2.5',
cookie: false
});
FacebookActions.sdkReady();
};
}
onSdkReady() {
this.loaded = true;
}
}
export default altThirdParty.createStore(FacebookHandler, 'FacebookHandler');