diff --git a/viewer/js/viewer/_MapMixin.js b/viewer/js/viewer/_MapMixin.js index 1c0eeab15..b69ca1c5a 100644 --- a/viewer/js/viewer/_MapMixin.js +++ b/viewer/js/viewer/_MapMixin.js @@ -39,19 +39,31 @@ define([ var returnDeferred = new Deferred(); var returnWarnings = []; - this._createMap(returnWarnings).then( + this.createMap(returnWarnings).then( lang.hitch(this, '_createMapResult', returnDeferred, returnWarnings) ); returnDeferred.then(lang.hitch(this, 'initMapComplete')); return returnDeferred; }, - _createMap: function (returnWarnings) { + createMap: function (returnWarnings) { + var returnWarnings = []; var mapDeferred = new Deferred(), container = dom.byId(this.config.layout.map) || 'mapCenter'; this.map = new Map(container, this.config.mapOptions); - mapDeferred.resolve(returnWarnings); + + // let some other mixins modify or add map items async + var wait = this.inherited(arguments); + if (wait) { + wait.then(function (warnings) { + // are warnings passed? + // returnWarnings.push(warnings); + mapDeferred.resolve(returnWarnings); + }); + } else { + mapDeferred.resolve(returnWarnings); + } return mapDeferred; }, diff --git a/viewer/js/viewer/_WebMapMixin.js b/viewer/js/viewer/_WebMapMixin.js index 9bd9ad373..2731135b8 100644 --- a/viewer/js/viewer/_WebMapMixin.js +++ b/viewer/js/viewer/_WebMapMixin.js @@ -25,10 +25,10 @@ define([ return declare(null, { startup: function () { this.inherited(arguments); - this.mapDeferred.then(lang.hitch(this, '_initWebMap')); + // this.mapDeferred.then(lang.hitch(this, '_initWebMap')); }, - _initWebMap: function () { + createMap: function () { var webMapOptions = this.config.webMapOptions || {}; if (!webMapOptions.mapOptions && this.config.mapOptions) { webMapOptions.mapOptions = this.config.mapOptions;