What is the function google.maps.event.addDomListener (window, "download", initialization) ;?

I tried to use google maps. I found this expression.

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

What is the function of this statement?

+6
source share
2 answers

It adds a listener to the window object, which, as soon as the load event fires (that is, "the page has finished loading"), performs the initialize function.

those. this delays the Google Map-related script until the page finishes loading.

+9
source

The @Dust function is initialized and called only after loading the <div> element. in maps.event ..., I think an event is an element, because, in essence, it contains information about the map canvas

+1
source

Source: https://habr.com/ru/post/1492256/


All Articles