fix possible async issue

This commit is contained in:
dkanada 2020-02-20 02:07:41 +09:00
parent 79aa40465c
commit 53db7fe215

View File

@ -1,16 +1,26 @@
define(['appStorage', 'events'], function (appStorage, events) {
'use strict';
var data = {};
var data;
function getConfig() {
if (data) {
return data;
}
function WebSettings() {
fetch("/config.json").then(function (response) {
data = response.json();
})
return data;
}
function WebSettings() {
getConfig();
}
WebSettings.prototype.enableMultiServer = function () {
return data.multiServer || false;
return getConfig().multiServer || false;
};
return new WebSettings();