On Style Events 方式
var mapExtentChange = map.on("extent-change", changeHandler);
function changeHandler(evt){
var extent = evt.extent,
zoomed = evt.levelChange;
// ... Do something ...
// in some cases, you may want to disconnect the event listener
mapExtentChange.remove();
}
Connect Style Event方式
dojo/_base/connect (also dojo.connect) example:
require(["dojo/_base/connect", "esri/map"],function(connect, Map) {
...
var mapExtentChange_connect = connect.connect(map, "onExtentChange", changeHandler_connect);
function changeHandler_connect(extent, delta, levelChange, lod){
// ... Do something ...
// in some cases, you may want to disconnect the event listener
connect.disconnect(mapExtentChange_connect);
}
}
https://developers.arcgis.com/javascript/jshelp/inside_events.html
---------------------
作者:萝卜耳朵
来源:CSDN
原文:https://blog.csdn.net/luckypeng/article/details/44409501
版权声明:本文为博主原创文章,转载请附上博文链接!