<?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: using reactiveutils to watch status of a panel? in Calcite Design System Questions</title>
    <link>https://community.esri.com/t5/calcite-design-system-questions/using-reactiveutils-to-watch-status-of-a-panel/m-p/1293186#M411</link>
    <description>&lt;P&gt;Hi Gary,&lt;/P&gt;&lt;P&gt;I use state to handle things like this. Highly recommend.&lt;/P&gt;&lt;P&gt;1) When your panel closes, update your state's panelStatus. Do this regardless of whether it closed via the `x` button or `close` button or another panel opening, etc. Each of these triggers an update to state.panelStatus. Perhaps also state.panelStatus maintains the states of multiple panels.&lt;/P&gt;&lt;P&gt;2) "React" to this state change accordingly from a single point in your code.&lt;/P&gt;&lt;P&gt;There's a react + Esri JS example here that I drew a lot of inspiration from, a fork of Rene's work (from Esri)&amp;nbsp;&lt;A href="https://github.com/coryeicher/jsapi-esm-react/tree/main" target="_blank"&gt;https://github.com/coryeicher/jsapi-esm-react/tree/main.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;We have used this approach with great success to build a React + Esri JS + Calcite component library.&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 May 2023 17:43:44 GMT</pubDate>
    <dc:creator>coryeicher</dc:creator>
    <dc:date>2023-05-25T17:43:44Z</dc:date>
    <item>
      <title>using reactiveutils to watch status of a panel?</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/using-reactiveutils-to-watch-status-of-a-panel/m-p/1293181#M410</link>
      <description>&lt;P&gt;I have a Calcite panel that could be opened from action bar (or closed if the action bar button is pressed again), could be closed using the X on the panel itself, or could be closed programmatically when another panel is opened.&amp;nbsp; Rather than wiring up what happens when the button is pressed on the action bar, or when the X is pressed on the panel, etc., can't I just use the following code in my setup to watch the panel&amp;nbsp; closed property (it doesn't seem to work)?&amp;nbsp; This seems a lot cleaner than setting up some sort of helper function that gets called from various places.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;let myPanel = document.getElementById('my-panel') as HTMLCalcitePanelElement

reactiveUtils.watch(
    () =&amp;gt; myPanel.closed,
    (panelClosedStatus) =&amp;gt; {
        console.log('my panel closed status just changed')
     }
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 17:28:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/using-reactiveutils-to-watch-status-of-a-panel/m-p/1293181#M410</guid>
      <dc:creator>GaryB</dc:creator>
      <dc:date>2023-05-25T17:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: using reactiveutils to watch status of a panel?</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/using-reactiveutils-to-watch-status-of-a-panel/m-p/1293186#M411</link>
      <description>&lt;P&gt;Hi Gary,&lt;/P&gt;&lt;P&gt;I use state to handle things like this. Highly recommend.&lt;/P&gt;&lt;P&gt;1) When your panel closes, update your state's panelStatus. Do this regardless of whether it closed via the `x` button or `close` button or another panel opening, etc. Each of these triggers an update to state.panelStatus. Perhaps also state.panelStatus maintains the states of multiple panels.&lt;/P&gt;&lt;P&gt;2) "React" to this state change accordingly from a single point in your code.&lt;/P&gt;&lt;P&gt;There's a react + Esri JS example here that I drew a lot of inspiration from, a fork of Rene's work (from Esri)&amp;nbsp;&lt;A href="https://github.com/coryeicher/jsapi-esm-react/tree/main" target="_blank"&gt;https://github.com/coryeicher/jsapi-esm-react/tree/main.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;We have used this approach with great success to build a React + Esri JS + Calcite component library.&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 17:43:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/using-reactiveutils-to-watch-status-of-a-panel/m-p/1293186#M411</guid>
      <dc:creator>coryeicher</dc:creator>
      <dc:date>2023-05-25T17:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: using reactiveutils to watch status of a panel?</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/using-reactiveutils-to-watch-status-of-a-panel/m-p/1293190#M412</link>
      <description>&lt;P&gt;Thank you Cory! Unfortunately I haven't quite made the leap to React yet but I've been thinking about diving in for exactly these reasons.&amp;nbsp; Any other vanilla JavaScript ideas for approaching this would be appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 17:55:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/using-reactiveutils-to-watch-status-of-a-panel/m-p/1293190#M412</guid>
      <dc:creator>GaryB</dc:creator>
      <dc:date>2023-05-25T17:55:18Z</dc:date>
    </item>
  </channel>
</rss>

