<?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: How to replace watchUtils.whenFalseOnce to the equivalent in reactiveUtils in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-replace-watchutils-whenfalseonce-to-the/m-p/1247535#M79864</link>
    <description>&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;Your suggested option seems to be what I need.&lt;/P&gt;&lt;P&gt;I'm counting the features for each layer in the view and I have to count again every time the view changes. Today I do it with layerView.watch('updating'... for every layer and I also catch separately the visibility of the layers since the layerView doen't update when the layer not visible. With your option everything will be simpler. I'm starting to put it in my code.&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;Marcelo&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jan 2023 06:27:11 GMT</pubDate>
    <dc:creator>MarceloRosensaft</dc:creator>
    <dc:date>2023-01-12T06:27:11Z</dc:date>
    <item>
      <title>How to replace watchUtils.whenFalseOnce to the equivalent in reactiveUtils</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-replace-watchutils-whenfalseonce-to-the/m-p/1247177#M79846</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;We have a code chunk that works - taken from a post by &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/250370"&gt;@RobErt&lt;/a&gt; Scheitlin, but uses watchUtils which is deprecated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;watchUtils.whenFalse(view, 'stationary', (evt) =&amp;gt; {
        if (!view.stationary) {
            watchUtils.whenTrueOnce(view, 'stationary', function (evt) {
                console.log(view.extent);
            });
        } else {
            watchUtils.whenFalseOnce(view, 'interacting', function (evt) {
                console.log(view.extent);
            });
        }
    })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How should we convert it to using the reactiveUtils tools?&lt;/P&gt;&lt;P&gt;Thank you in advance,&lt;/P&gt;&lt;P&gt;Marcelo&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 11:14:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-replace-watchutils-whenfalseonce-to-the/m-p/1247177#M79846</guid>
      <dc:creator>MarceloRosensaft</dc:creator>
      <dc:date>2023-01-11T11:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace watchUtils.whenFalseOnce to the equivalent in reactiveUtils</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-replace-watchutils-whenfalseonce-to-the/m-p/1247261#M79848</link>
      <description>&lt;P&gt;The reactiveUtils have an option object you can provide where you can set "once" to true.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#ReactiveListenerOptions" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#ReactiveListenerOptions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Your above code snippet would look something like this, but the way you have it written, the else is unreachable, maybe the main is watch and not whenFalse?&amp;nbsp;&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;	when(
		() =&amp;gt; !view.stationary,
		() =&amp;gt; {
			console.log("view stationary is: ", view.stationary);
			when(
				() =&amp;gt; view.stationary,
				() =&amp;gt; console.log("view is now stationary"),
				{ once: true }
			);
		}
	);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a codepen with both options.&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/odoe/pen/zYLwKGb?editors=0010" target="_blank" rel="noopener"&gt;https://codepen.io/odoe/pen/zYLwKGb?editors=0010&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 15:00:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-replace-watchutils-whenfalseonce-to-the/m-p/1247261#M79848</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2023-01-11T15:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace watchUtils.whenFalseOnce to the equivalent in reactiveUtils</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-replace-watchutils-whenfalseonce-to-the/m-p/1247535#M79864</link>
      <description>&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;Your suggested option seems to be what I need.&lt;/P&gt;&lt;P&gt;I'm counting the features for each layer in the view and I have to count again every time the view changes. Today I do it with layerView.watch('updating'... for every layer and I also catch separately the visibility of the layers since the layerView doen't update when the layer not visible. With your option everything will be simpler. I'm starting to put it in my code.&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;Marcelo&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 06:27:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-replace-watchutils-whenfalseonce-to-the/m-p/1247535#M79864</guid>
      <dc:creator>MarceloRosensaft</dc:creator>
      <dc:date>2023-01-12T06:27:11Z</dc:date>
    </item>
  </channel>
</rss>

