aerisjs
aerisjs copied to clipboard
map.destroy()
Is there any possibility to destroy the Aeris.map
object. See http://jsfiddle.net/muhaimincs/feogb02k/
There is a destroy()
method on all MapExtensionObject
objects, including aeris.map.Map
objects (and Marker
s, etc...). The default behavior of the destroy()
method is to unbind all events from the object, and to stop rendering any changes to the object.
You'll notice that if you destroy the map, clicking on it no longer creates markers. Also, any methods like setZoom
or setCenter
will no longer have any effect.
I could see an argument for having Map#destroy
actually erase the map view from the DOM. You could do this manually by emptying your map container element.
Or, you can submit a pull request with the change to Map#destroy
:+1: . This should be fairly straight-forward -- the Map object has a mapEl_
HTMLElement property you can mess with. If you need help getting your dev environment setup or writing/running tests, I'd be happy to walk you through it.
Edan
i see.. because all this while, i keep pondering why there are a lot of detached html even we unbind everything and empty the map container. That's only my concern
You have a point, there.
I notice that Leafet has a L.Map#destroy
method:
Destroys the map and clears all related event listeners.
Google maps may have something similar. It would make sense, then, that if we changed the aeris.maps.Map#destroy
event to remove the Leaflet/Google maps container element, that we should also call the respective mapping library's Map#destroy
method.
I can put this on our backlog, though to be honest, it would probably be a while to release, as it's low priority relative to some other stuff we're working on. But if you want to take a stab at it, I can point you in the right direction.