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,427
  • 10
  • 48
  • 90

2 Answers2

89

Try something like:

google.maps.event.addListenerOnce(map, 'idle', function(){
    //loaded fully
});
orange01
  • 1,474
  • 14
  • 26
Sudhir Bastakoti
  • 97,363
  • 15
  • 155
  • 158
19

How about the tilesloadedevent?

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