javascript - Set a timeout limit for Google Maps, and how to test it? -
is out there using timeout on google maps api? have google map gets loaded fusion table. client wants me resort different solution if maps doesn't load in x seconds.
i tried using javascript timeout function , $(document).ready, found jquery ready firing before map rendered screen.
with said... 1 know way force timeout test of solutions available.
thanks, andy
could use tilesloaded
event? code this:
// set map , timeout var map = new google.maps.map(document.getelementbyid("map"), someoptions), timeoutseconds = 4, usingmap = false; function doalternatestuff() { // whatever fallback requires } // set timeout , store reference var timer = window.settimeout(doalternatestuff, timeoutseconds * 1000); // listen tilesloaded event google.maps.event.addlistener(map, 'tilesloaded', function() { // cancel timeout window.cleartimeout(timer); usingmap = true; // etc });
Comments
Post a Comment