Jurgis Stepanovs
unread,Aug 13, 2010, 1:49:47 AM8/13/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Maps JavaScript API v3
Hi!
I use code bellow to read markers from DB, when user visible map area
changes.
...
google.maps.event.addListener(map, 'bounds_changed', function() { //
bounds_changed or zoom_changed or center_changed
readDataFromDB;
});
...
But serious problem is that listener executes to often 3 or 4 times
when expecting only 1, and my
DB server gets huge loads of unnecessary queries. I think most on fast
mouse wheeling (zooming in and out).
How to set this trigger to work more slowly?
I tried setTimeout(readDataFromDB(),2000), but it seems not to do
right thing, because
I suppose that during that timeout happens more bounds_change events
that waits
for JavasScript code execution loop. At the end code is executed also
3,4 times, but with 2sec
delay.
Todays Internet user is a lot using mouse wheel, and a lots moving
around with mouse, and it will kill my application if things will not
change ;)
I suggest Google API 3 engineers to implement this timeout option
directly
in the core of 'bounds_changed' listener.
May be someone has developed solution already?
PS I’m testing app on Chrome and IE …