<?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 I want to trigger events when the currentStyleInfo style layers' values change in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-trigger-events-when-the-currentstyleinfo/m-p/1391490#M83865</link>
    <description>&lt;P&gt;I want to trigger events when the currentStyleInfo style layers settings change. I have attempted to do so using the reactiveUtils, but the changes are not being detected. How can I achieve this? Is it possible? This is in an angular application and I would rather apply the change and detect it through a trigger from the layer than firing something that doesn't include the layer as part of the detection process.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  reactiveUtils.watch(
      () =&amp;gt;
        mapView.map.layers.map((layer) =&amp;gt;
          (layer as NavigationLayer)?.currentStyleInfo?.style.layers.map(
            (layer: any) =&amp;gt; {
              console.log('layer = ', `${layer.id} ${layer.layout.visibility}`);
              return `${layer.id} ${layer.layout.visibility}`;
            }
          )
        ),
      (newValue, oldValue) =&amp;gt; {
        console.table('oldValue', oldValue.toArray());
        console.table('newValue', newValue.toArray());
      }
    );&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I know I can get it to work for the regular layer level 'visible' which is great. Just seems for things within currentStyleInfo the changes do not propagate as watchable&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt; reactiveUtils.watch(
      () =&amp;gt; mapView.map.layers.map((layer) =&amp;gt; layer.visible),
      (newValue, oldValue) =&amp;gt; {
        console.table(oldValue.toArray());
        console.table(newValue.toArray());
      }
    );&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you all ahead of time.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2024 21:31:15 GMT</pubDate>
    <dc:creator>JonathanBorgia</dc:creator>
    <dc:date>2024-03-05T21:31:15Z</dc:date>
    <item>
      <title>I want to trigger events when the currentStyleInfo style layers' values change</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-trigger-events-when-the-currentstyleinfo/m-p/1391490#M83865</link>
      <description>&lt;P&gt;I want to trigger events when the currentStyleInfo style layers settings change. I have attempted to do so using the reactiveUtils, but the changes are not being detected. How can I achieve this? Is it possible? This is in an angular application and I would rather apply the change and detect it through a trigger from the layer than firing something that doesn't include the layer as part of the detection process.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  reactiveUtils.watch(
      () =&amp;gt;
        mapView.map.layers.map((layer) =&amp;gt;
          (layer as NavigationLayer)?.currentStyleInfo?.style.layers.map(
            (layer: any) =&amp;gt; {
              console.log('layer = ', `${layer.id} ${layer.layout.visibility}`);
              return `${layer.id} ${layer.layout.visibility}`;
            }
          )
        ),
      (newValue, oldValue) =&amp;gt; {
        console.table('oldValue', oldValue.toArray());
        console.table('newValue', newValue.toArray());
      }
    );&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I know I can get it to work for the regular layer level 'visible' which is great. Just seems for things within currentStyleInfo the changes do not propagate as watchable&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt; reactiveUtils.watch(
      () =&amp;gt; mapView.map.layers.map((layer) =&amp;gt; layer.visible),
      (newValue, oldValue) =&amp;gt; {
        console.table(oldValue.toArray());
        console.table(newValue.toArray());
      }
    );&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you all ahead of time.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 21:31:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-trigger-events-when-the-currentstyleinfo/m-p/1391490#M83865</guid>
      <dc:creator>JonathanBorgia</dc:creator>
      <dc:date>2024-03-05T21:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: I want to trigger events when the currentStyleInfo style layers' values change</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-trigger-events-when-the-currentstyleinfo/m-p/1401459#M84136</link>
      <description>&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I worked with some folks on the development team to confirm this is not possible at this time - managing map state in another way will be required. If this continues to be of interest, please submit an Enhancement Request through the Support Site so we can track interest in adding that feature.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 14:40:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-trigger-events-when-the-currentstyleinfo/m-p/1401459#M84136</guid>
      <dc:creator>SamLibby</dc:creator>
      <dc:date>2024-03-27T14:40:33Z</dc:date>
    </item>
  </channel>
</rss>

