Commit 21f3e5af authored by Piotr Gawron's avatar Piotr Gawron
Browse files

opening overlays should be done sequentially

parent 2ee4a50c
Pipeline #2648 passed with stage
in 43 seconds
......@@ -70,7 +70,7 @@ CustomMap.prototype.constructor = CustomMap;
* This code must be run after the object is created. It requires to download
* some data via promises.
*
* @return promise with empty result
* @return {Promise} with empty result
*/
CustomMap.prototype.init = function () {
var self = this;
......@@ -85,11 +85,9 @@ CustomMap.prototype.init = function () {
ids.push(mapType);
}
for (var i = 0; i < ids.length; i++) {
var id = ids[i];
return Promise.each(ids, function (overlayId) {
try {
var promise = self.openDataOverlay(id);
openOverlaysPromises.push(promise);
return self.openDataOverlay(overlayId);
} catch (e) {
if (e instanceof SecurityError) {
logger.debug(e.message);
......@@ -98,10 +96,7 @@ CustomMap.prototype.init = function () {
return Promise.reject(e);
}
}
}
return Promise.all(openOverlaysPromises).then(function () {
}).then(function () {
return ServerConnector.getLogoImg()
}).then(function (url) {
var logo2 = self.getControl(ControlType.LOGO_2_IMG);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment