What is the Proper Way to Destroy a Map Instance?

前端 未结 7 1527
旧巷少年郎
旧巷少年郎 2020-11-27 13:18

I recently developed an html5 mobile application. The application was a single page where navigation hash change events replaced the entire DOM. One section of the applicati

7条回答
  •  清酒与你
    2020-11-27 13:23

    When you remove the div, that removes the display panel and the map will disappear. To remove the map instance, just make sure that your reference to the map is set to null and that any references to other parts of the map are set to null. At that point, JavaScript garbage collection will take care of cleaning up, as described in: How does garbage collection work in JavaScript?.

提交回复
热议问题