1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00
onion/js/third_party/facebook_handler.js

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-11-09 17:46:49 +01:00
'use strict';
import { altThirdParty } from '../alt';
2016-01-06 15:13:09 +01:00
2015-11-09 17:46:49 +01:00
import EventActions from '../actions/event_actions';
2016-01-06 15:13:09 +01:00
import FacebookActions from '../actions/facebook_actions';
2015-11-09 17:46:49 +01:00
import AppConstants from '../constants/application_constants'
class FacebookHandler {
constructor() {
2016-01-06 15:13:09 +01:00
this.loaded = false;
2015-11-09 17:46:49 +01:00
this.bindActions(EventActions);
2016-01-06 15:13:09 +01:00
this.bindActions(FacebookActions);
2015-11-09 17:46:49 +01:00
}
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,
2016-01-06 15:13:09 +01:00
// Don't parse anything on the first load as we will parse all XFBML components as necessary.
xfbml: false,
2015-11-09 17:46:49 +01:00
version: 'v2.5',
cookie: false
});
2016-01-06 15:13:09 +01:00
FacebookActions.sdkReady();
2015-11-09 17:46:49 +01:00
};
}
2016-01-06 15:13:09 +01:00
onSdkReady() {
this.loaded = true;
}
2015-11-09 17:46:49 +01:00
}
export default altThirdParty.createStore(FacebookHandler, 'FacebookHandler');