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

后端 未结 2 985
予麋鹿
予麋鹿 2021-01-18 00:53

I was trying Google maps. I found this statement.

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

what is the function of t

2条回答
  •  无人及你
    2021-01-18 01:20

    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.

提交回复
热议问题