栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Google Maps API v3中的OVER_QUERY_LIMIT:如何在Javascript中暂停/延迟以降低速度?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Google Maps API v3中的OVER_QUERY_LIMIT:如何在Javascript中暂停/延迟以降低速度?

迈克·威廉姆斯的教程中没有出现这两行:

    wait = true;    setTimeout("wait = true", 2000);

这是第3版端口:

http://acleach.me.uk/gmaps/v3/plotaddresses.htm

相关的代码位是

  // ====== Geocoding ======  function getAddress(search, next) {    geo.geopre({address:search}, function (results,status)      {         // If that was successful        if (status == google.maps.GeoprerStatus.OK) {          // Lets assume that the first marker is the one we want          var p = results[0].geometry.location;          var lat=p.lat();          var lng=p.lng();          // Output the data var msg = 'address="' + search + '" lat=' +lat+ ' lng=' +lng+ '(delay='+delay+'ms)<br>'; document.getElementById("messages").innerHTML += msg;          // Create a marker          createMarker(search,lat,lng);        }        // ====== Depre the error status ======        else {          // === if we were sending the requests to fast, try this one again and increase the delay          if (status == google.maps.GeoprerStatus.OVER_QUERY_LIMIT) { nextAddress--; delay++;          } else { var reason="Code "+status; var msg = 'address="' + search + '" error=' +reason+ '(delay='+delay+'ms)<br>'; document.getElementById("messages").innerHTML += msg;          }}        next();      }    );  }


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/517875.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号