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


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?

1 Answer 1


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 and acknowledge you have read our privacy policy.

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