[common] debug plugins loading

This commit is contained in:
Maxim Kadushkin 2019-03-04 18:13:52 +03:00
parent a6091d9326
commit 1e5a6e6c8d

View file

@ -593,27 +593,29 @@ define([
}, },
getAppConfigPlugins: function (config) { getAppConfigPlugins: function (config) {
var me = this; if ( config.UIpluginsData ) {
Promise.all(config.UIpluginsData.map(function(url) { var me = this;
return fetch(url) Promise.all(config.UIpluginsData.map(function(url) {
.then(function(response) {return response.json();}) return fetch(url)
.then(function(json) { .then(function(response) {return response.json();})
json.baseUrl = url.substring(0, url.lastIndexOf("config.json")); .then(function(json) {
return json; json.baseUrl = url.substring(0, url.lastIndexOf("config.json"));
}); return json;
})).then(function(values) { });
me.parsePlugins(values, true); })).then(function(values) {
me.parsePlugins(values, true);
if ( me.plugins.uicustom ) { if ( me.plugins.uicustom ) {
me.plugins.uicustom.forEach(function (c) { me.plugins.uicustom.forEach(function (c) {
fetch(c.url) fetch(c.url)
.then(function (response) {return response.text();}) .then(function (response) {return response.text();})
.then(function (text) {c.code = text;}); .then(function (text) {c.code = text;});
}); });
} }
}).catch(function(e) { }).catch(function(e) {
console.log('error: ' + e.message); console.log('error: ' + e.message);
}); });
}
}, },
}, Common.Controllers.Plugins || {})); }, Common.Controllers.Plugins || {}));