Here is my latest installment. I linked to the onClick event of the basemapGallery Nodes: //Listen for a change of basemap (NIM080755)
dojo.forEach(dojo.query(".esriBasemapGalleryNode"),function(galleryNode){
dojo.connect(galleryNode,"onclick",function(){
_this._basemapButton.closeDropDown();
_this._disableAllMapFunctionUntilBasemapUpdates();
});
});
The following function disables the map until it is done updating://this is a a stopgap measure until ESRI fixes NIM080755
_disableAllMapFunctionUntilBasemapUpdates: function(){
var _this = this;
//disable the map it id done updating the basemap
var mapStandby = new dojox.widget.Standby({target: _this.map.container});
document.body.appendChild(mapStandby.domNode);
mapStandby.startup();
mapStandby.show();
var mapUpdateEndConnect = dojo.connect(_this.map,"onUpdateEnd",function(){
mapStandby.destroy();
dojo.disconnect(mapUpdateEndConnect);
});
}
Finally, if all else fails I give the user an alert so they know something might have gone wrong. //added to account for errors caused by NIM080755
window.onerror = function(){
alert("An error has occured.\nYou're map will likely continue to function, but you may see inconsistent results.\nRefresh your browser to start over.");
};