<?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: Finding which layer fired an update-start event in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451401#M41701</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Typically your event handler function is specific to your layer so it should be self evident; in other words if you have specific functions for layer1 then you put those in the layer1 event handler, and functions for layer2 go in the layer2 event handler. But if you want some kind of visual cue you can either put some console.log statements into your event handler functions like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;layer1.on("update-start", function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("layer1 update-start");
});
layer2.on("update-start", function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("layer2 update-start");
});&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...or you can examine the evt object to get the layer id, name, url, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;layer1.on("update-start", function(evt){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(evt.target.id);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(evt.target.name);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(evt.target.url);
});&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:08:35 GMT</pubDate>
    <dc:creator>RyanClancy</dc:creator>
    <dc:date>2021-12-11T20:08:35Z</dc:date>
    <item>
      <title>Finding which layer fired an update-start event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451400#M41700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When handling an update-start event from a layer, is there a way to derive which layer threw the event?&amp;nbsp; The event seems to have no args.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 18:13:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451400#M41700</guid>
      <dc:creator>james-rae</dc:creator>
      <dc:date>2015-01-13T18:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Finding which layer fired an update-start event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451401#M41701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Typically your event handler function is specific to your layer so it should be self evident; in other words if you have specific functions for layer1 then you put those in the layer1 event handler, and functions for layer2 go in the layer2 event handler. But if you want some kind of visual cue you can either put some console.log statements into your event handler functions like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;layer1.on("update-start", function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("layer1 update-start");
});
layer2.on("update-start", function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("layer2 update-start");
});&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...or you can examine the evt object to get the layer id, name, url, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;layer1.on("update-start", function(evt){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(evt.target.id);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(evt.target.name);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(evt.target.url);
});&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:08:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451401#M41701</guid>
      <dc:creator>RyanClancy</dc:creator>
      <dc:date>2021-12-11T20:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Finding which layer fired an update-start event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451402#M41702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply.&amp;nbsp;&amp;nbsp; My site has dynamically added layers, so having a custom hardcoded function for each is not an option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The evt object sounds great...except it's always undefined (or is for me, anyways).&amp;nbsp; The API documentation seems to support this.&amp;nbsp; Do you actually see values in your evt param?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been able to hack around the issue by having the handler be defined on the layer object itself, and can then find out who raised the event using the "this" variable.&amp;nbsp; Will do for now but pretty messy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 21:16:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451402#M41702</guid>
      <dc:creator>james-rae</dc:creator>
      <dc:date>2015-01-13T21:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Finding which layer fired an update-start event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451403#M41703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, my evt object is populated with properties. When I do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14211839922746060 jive_text_macro" jivemacro_uid="_14211839922746060"&gt;&lt;P&gt;console.log(evt.target.name);&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... it prints the layer name in the console (firebug). And when I do &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14211840380538832" jivemacro_uid="_14211840380538832"&gt;&lt;P&gt;console.dir(evt);&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can explore the entire object.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 21:20:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451403#M41703</guid>
      <dc:creator>RyanClancy</dc:creator>
      <dc:date>2015-01-13T21:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Finding which layer fired an update-start event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451404#M41704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just tried a bare-bones example and yep, it has a value.&amp;nbsp; So something in my big scary app must be breaking it, but that's not the API's fault.&amp;nbsp; Thank you for your time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 21:24:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451404#M41704</guid>
      <dc:creator>james-rae</dc:creator>
      <dc:date>2015-01-13T21:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Finding which layer fired an update-start event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451405#M41705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 21:42:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/finding-which-layer-fired-an-update-start-event/m-p/451405#M41705</guid>
      <dc:creator>RyanClancy</dc:creator>
      <dc:date>2015-01-13T21:42:34Z</dc:date>
    </item>
  </channel>
</rss>

