|
@@ -3,8 +3,8 @@ import 'whatwg-fetch';
|
|
|
|
|
|
window.lofig = {
|
|
|
folder: 'config/default.json',
|
|
|
- get: (query, callback) => {
|
|
|
- fetch(lofig.folder)
|
|
|
+ get: query => {
|
|
|
+ return fetch(lofig.folder)
|
|
|
.then(response => {
|
|
|
return response.json();
|
|
|
}).then(json => {
|
|
@@ -12,14 +12,14 @@ window.lofig = {
|
|
|
return Promise.each(query, property => {
|
|
|
json = json[property];
|
|
|
}).then(() => {
|
|
|
- callback(json);
|
|
|
+ return json;
|
|
|
});
|
|
|
}).catch(err => {
|
|
|
console.log('parsing failed', err);
|
|
|
});
|
|
|
},
|
|
|
- has: (query, callback) => {
|
|
|
- fetch(lofig.folder)
|
|
|
+ has: query => {
|
|
|
+ return fetch(lofig.folder)
|
|
|
.then(response => {
|
|
|
return response.json();
|
|
|
}).then(json => {
|
|
@@ -27,8 +27,8 @@ window.lofig = {
|
|
|
return Promise.each(query, property => {
|
|
|
json = json[property];
|
|
|
}).then(() => {
|
|
|
- if (json) callback(true);
|
|
|
- else callback(false);
|
|
|
+ if (json) return true;
|
|
|
+ else return false;
|
|
|
});
|
|
|
}).catch(err => {
|
|
|
console.log('parsing failed', err);
|