43

Is there any listener to handle map completely loaded?

In my case, I need to get bounds from map, so I've done it this way:

google.maps.event.addListener(this.map, "bounds_changed", this.mapLoaded);

mapLoaded: function() {
    google.maps.event.clearListeners(this.map, "bounds_changed");

    var bounds = this.map.getBounds();

    this.collection.setBounds(bounds.getNorthEast(), bounds.getSouthWest());
    this.collection.fetch();
},

Is there any not-hacking way?

skayred
  • 10,603
  • 10
  • 52
  • 94

2 Answers2

89

Try something like:

google.maps.event.addListenerOnce(map, 'idle', function(){
    //loaded fully
});
orange01
  • 1,584
  • 1
  • 16
  • 28
Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162
19

How about the tilesloadedevent?

google.maps.event.addListener(map, 'tilesloaded', function() {
  // Visible tiles loaded!
});
Ash
  • 3,136
  • 2
  • 21
  • 12