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:
parent
4a3a368fc5
commit
3c72ee331d
37
js/app.js
37
js/app.js
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let ag = new AppGateway();
|
||||
ag.start();
|
||||
// Initialize pre-start components
|
||||
initLogging();
|
||||
|
||||
requests.defaults({
|
||||
urlMap: ApiUrls,
|
||||
http: {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
credentials: 'include'
|
||||
}
|
||||
});
|
||||
|
||||
// And bootstrap app
|
||||
AppGateway.start();
|
||||
|
Loading…
Reference in New Issue
Block a user