<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Same event handler for multiple maps in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-event-handler-for-multiple-maps/m-p/524046#M48880</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, that works. I ended up doing this though:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var mapExtentChange = map.on("extent-change", function(evt){
&amp;nbsp;&amp;nbsp;&amp;nbsp; changeHandler(evt, "map")
});

var mapExtentChange = map2.on("extent-change", function(evt){
&amp;nbsp;&amp;nbsp;&amp;nbsp; changeHandler(evt, "map2")
});


function changeHandler(evt, mapX){
&amp;nbsp;&amp;nbsp;&amp;nbsp; //do stuff here with mapX.....
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:50:43 GMT</pubDate>
    <dc:creator>JosephSaltenberger</dc:creator>
    <dc:date>2021-12-11T22:50:43Z</dc:date>
    <item>
      <title>Same event handler for multiple maps</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-event-handler-for-multiple-maps/m-p/524044#M48878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var mapExtentChange = map.on("extent-change", changeHandler);
var mapExtentChange = map2.on("extent-change", changeHandler);

function changeHandler(evt){
&amp;nbsp;&amp;nbsp; //if map1 fired then...
&amp;nbsp;&amp;nbsp; map1.extent = evt.extent;
&amp;nbsp;&amp;nbsp; //else
&amp;nbsp;&amp;nbsp; map2.extent = evt.extent;
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2014 04:04:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-event-handler-for-multiple-maps/m-p/524044#M48878</guid>
      <dc:creator>JosephSaltenberger</dc:creator>
      <dc:date>2014-02-19T04:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Same event handler for multiple maps</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-event-handler-for-multiple-maps/m-p/524045#M48879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;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&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var mapExtentChange = map.on("extent-change", changeHandler);
var mapExtentChange = map2.on("extent-change", changeHandler);

function changeHandler(evt){
&amp;nbsp;&amp;nbsp; //if map1 fired then...
&amp;nbsp;&amp;nbsp; map1.extent = evt.extent;
&amp;nbsp;&amp;nbsp; //else
&amp;nbsp;&amp;nbsp; map2.extent = evt.extent;
}&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can inspect the evt.target.container.id property to discover who raised the event.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:50:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-event-handler-for-multiple-maps/m-p/524045#M48879</guid>
      <dc:creator>RobertoPepato</dc:creator>
      <dc:date>2021-12-11T22:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Same event handler for multiple maps</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-event-handler-for-multiple-maps/m-p/524046#M48880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, that works. I ended up doing this though:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var mapExtentChange = map.on("extent-change", function(evt){
&amp;nbsp;&amp;nbsp;&amp;nbsp; changeHandler(evt, "map")
});

var mapExtentChange = map2.on("extent-change", function(evt){
&amp;nbsp;&amp;nbsp;&amp;nbsp; changeHandler(evt, "map2")
});


function changeHandler(evt, mapX){
&amp;nbsp;&amp;nbsp;&amp;nbsp; //do stuff here with mapX.....
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:50:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-event-handler-for-multiple-maps/m-p/524046#M48880</guid>
      <dc:creator>JosephSaltenberger</dc:creator>
      <dc:date>2021-12-11T22:50:43Z</dc:date>
    </item>
  </channel>
</rss>

