What is the function of google.maps.event.addDomListener(window, 'load', initialize);?

柔情痞子 提交于 2019-12-19 19:56:07

问题


I was trying Google maps. I found this statement.

google.maps.event.addDomListener(window, 'load', initialize);

what is the function of that statement ?


回答1:


It adds a listener to the window object, which as soon as the load event is triggered (i.e. "the page has finished loading") executes the function initialize.

I.e. it delays the Google Map related script until the page has finished loading.




回答2:


@Dust function is initialize and it is called only after the <div> element is loaded. in maps.event..., I think event is element because essentially it contains the map-canvas information.



来源:https://stackoverflow.com/questions/17742314/what-is-the-function-of-google-maps-event-adddomlistenerwindow-load-initial

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!