Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
54
gaia/apps/communications/contacts/js/fb/fb_init.js
Executable file
54
gaia/apps/communications/contacts/js/fb/fb_init.js
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
'use strict';
|
||||
|
||||
/* global utils */
|
||||
|
||||
var fb = window.fb || {};
|
||||
var config = window.config || {};
|
||||
|
||||
if (typeof fb.init === 'undefined') {
|
||||
(function() {
|
||||
var initialized = false;
|
||||
var initializing = false;
|
||||
var EV_FB_INIT = 'fb_init_initialized';
|
||||
|
||||
fb.isEnabled = false;
|
||||
|
||||
fb.init = function(callback) {
|
||||
if (initialized) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
if (initializing) {
|
||||
document.addEventListener(EV_FB_INIT, function handler(e) {
|
||||
initializing = false;
|
||||
document.removeEventListener(EV_FB_INIT, handler);
|
||||
callback();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
initializing = true;
|
||||
utils.config.load('/contacts/config.json').then(
|
||||
function cLoaded(configData) {
|
||||
if (configData.facebookEnabled === true) {
|
||||
fb.isEnabled = true;
|
||||
}
|
||||
|
||||
fb.operationsTimeout = config.operationsTimeout =
|
||||
configData.operationsTimeout;
|
||||
fb.logLevel = configData.logLevel || 'none';
|
||||
fb.syncPeriod = configData.facebookSyncPeriod || 24;
|
||||
fb.testToken = configData.testToken;
|
||||
|
||||
initialized = true;
|
||||
|
||||
document.dispatchEvent(new CustomEvent(EV_FB_INIT));
|
||||
|
||||
callback();
|
||||
}, function loadError(err) {
|
||||
console.error('Error while loading config.json', err);
|
||||
});
|
||||
};
|
||||
})();
|
||||
}
|
||||
Loading…
Reference in a new issue