Changeset 2874
- Timestamp:
- 03/23/07 21:37:28 (2 years ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Map.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Map.js
r2863 r2874 33 33 /** @type OpenLayers.Events */ 34 34 events: null, 35 36 /** function that is called to destroy the map on page unload. stored 37 * here so that if map is manually destroyed, we can unregister this. 38 * 39 * @type Function */ 40 unloadDestroy: null, 35 41 36 42 /** the div that our map lives in … … 213 219 this.popups = new Array(); 214 220 221 this.unloadDestroy = this.destroy.bindAsEventListener(this); 222 223 215 224 // always call map.destroy() 216 OpenLayers.Event.observe(window, 217 'unload', 218 this.destroy.bindAsEventListener(this)); 225 OpenLayers.Event.observe(window, 'unload', this.unloadDestroy); 219 226 220 227 }, … … 224 231 */ 225 232 destroy:function() { 233 234 // map has been destroyed. dont do it again! 235 OpenLayers.Event.stopObserving(window, 'unload', this.unloadDestroy); 236 this.unloadDestroy = null; 237 226 238 if (this.layers != null) { 227 239 for(var i=0; i< this.layers.length; i++) { … … 242 254 } 243 255 this.viewPortDiv = null; 256 257 this.events.destroy(); 258 this.events = null; 259 244 260 }, 245 261
