简体   繁体   English

Google Maps API-事件监听器

[英]Google Maps API - Event Listeners

Is it necessary to remove Event listeners in when using google maps javascript api? 使用Google Maps JavaScript API时是否需要删除事件侦听器? "assume that code is working fine" “假设代码工作正常”

In other words do even listeners hinder website performance in such a way that one should ALWAYS remove/minimized unused listeners. 换句话说,即使是听众,也确实会妨碍网站的性能,以至于人们应该总是删除/最小化未使用的听众。

Thanks 谢谢

I assume you talk about GEvent 's from the Google Maps API. 我假设您是通过Google Maps API谈论GEvent的。 Personally, I haven't had any difficulties with them. 就我个人而言,我没有遇到任何困难。

Nor have I had any problems with adding say jQuery .mouseup() on the map canvas to trigger map events, although I recommend using GEvent 's for triggering and handling map-related stuff. 尽管我建议使用GEvent来触发和处理与地图相关的内容,但在地图画布上添加jQuery .mouseup()来触发地图事件也没有任何问题。

Edit: It'd be interesting with some profiling on having a simple map canvas, and see if other actions and performance is affected by removing GEvents. 编辑:在具有简单的地图画布上进行一些剖析会很有趣,并查看是否通过删除GEvents影响其他动作和性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Maps JS API v3:确定事件监听器的优先级 - Google Maps JS API v3: prioritize event listeners Google Maps API将侦听器添加到标记数组 - Google Maps API add Listeners to an array of markers Google Maps API v3-在“ for”循环内添加事件监听器仅在某些迭代中有效 - Google Maps API v3 - Adding Event Listeners inside 'for' loop only works in some iterations Google Maps API V3-图形管理器事件监听器被多次触发 - Google Maps API V3 - Drawing manager event listeners are fired multiple times Google Maps事件侦听器在Javascript'for'循环中无法正常工作 - Google Maps event listeners not working properly in a Javascript 'for' loop 为什么我的Google Maps事件监听器无法正常工作? - why are my google maps event listeners not working properly? 一个页面上有多个谷歌地图,带有 settimeouts 和 event.listeners - Multiple Google maps on one page with settimeouts and event.listeners 由 JavaScript 为 Google Maps Legend 创建的 html 元素的事件侦听器不起作用 - Event listeners to html elements created by javascript for Google Maps Legend is not working 如何向多个标记添加相同的事件侦听器,然后区分 Google Maps API v3 中侦听器中的标记? - How do I add same event listener to many markers and then differentiate between the markers in the listeners in Google Maps API v3? Google Maps API上的Longpress事件? - Longpress event on Google Maps API?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM