1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 10:25:08 +01:00

Convert AppGateway to be single instance

This commit is contained in:
Brett Sun 2016-01-04 13:14:50 +01:00
parent 4a3a368fc5
commit 3c72ee331d

View File

@ -33,22 +33,8 @@ import NotificationsHandler from './third_party/notifications';
import FacebookHandler from './third_party/facebook';
/* eslint-enable */
initLogging();
let headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
};
requests.defaults({
urlMap: ApiUrls,
http: {
headers: headers,
credentials: 'include'
}
});
class AppGateway {
const AppGateway = {
start() {
try {
const subdomain = getSubdomain();
@ -63,7 +49,7 @@ class AppGateway {
console.logGlobal(err);
this.load(getDefaultSubdomainSettings());
}
}
},
load(settings) {
const { subdomain, type } = settings;
@ -97,8 +83,21 @@ class AppGateway {
// Send the applicationDidBoot event to the third-party stores
EventActions.applicationDidBoot(settings);
}
};
// Initialize pre-start components
initLogging();
requests.defaults({
urlMap: ApiUrls,
http: {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
credentials: 'include'
}
});
let ag = new AppGateway();
ag.start();
// And bootstrap app
AppGateway.start();