1234567891011121314151617181920212223242526272829303132333435 |
- window.lofig = {
- folder: '/config/default.json',
- get: (query, cb) => {
- return fetch(lofig.folder)
- .then(response => {
- return response.json();
- }).then(json => {
- query.split('.')
- .forEach(property => {
- json = json[property];
- });
- if (cb) return cb(json);
- else return json;
- }).catch(err => {
- console.log('parsing failed', err);
- });
- },
- has: (query, cb) => {
- return fetch(lofig.folder)
- .then(response => {
- return response.json();
- }).then(json => {
- query.split('.')
- .forEach(property => {
- json = json[property];
- });
- if (cb) return cb(json);
- return json;
- }).catch(err => {
- console.log('parsing failed', err);
- });
- }
- };
|