jms143

Same event handler for multiple maps

Discussion created by jms143 on Feb 18, 2014
Latest reply on Feb 19, 2014 by jms143
Is there a way to identify which map instance fired the event handler in the following example? I could set up separate event handlers, but in this case, I will have many maps, and would prefer to keep the handler to one function. Thanks

var mapExtentChange = map.on("extent-change", changeHandler);
var mapExtentChange = map2.on("extent-change", changeHandler);

function changeHandler(evt){
   //if map1 fired then...
   map1.extent = evt.extent;
   //else
   map2.extent = evt.extent;
}

Outcomes