To check whether Google Maps is fully loaded with JavaScript, we call addListenerOnce
to listen for the first idle event triggered.
For instance, we write
google.maps.event.addListenerOnce(map, "idle", () => {
// ...
});
to call addListenerOnce
to listen for the first idle event triggered by calling it with the map
, 'idle'
, and the idle event handler callback.
If the callback is called, that means the Google Map is fully loaded.