0

I am trying to do same job for two different events on map using dojo on() function.

map.on('extent-change', function (event) {
//code goes here
}

and

map.on('zoom-end', function () {
//same code goes here
}

Is there any way that I could attach the events or do the same thing for both without writing the code again?

0

You can have one listener to multiple events in dojo

on(domNode, "click, focus", function(e){
    // handle both events 
  });

That said I do not think Esri library supports to listen multiple events using one event listener.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.