<?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 widget question: destroy event? in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/widget-question-destroy-event/m-p/787571#M3772</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to remove the click handler in my Pictometry widget if the user closes the widget. Regardless whether they've already clicked on the map. (I already have the covered, after the window.open(url), the next line is handlerPictometry.remove() )&amp;nbsp; Because currently the map.on 'click' handler stays active until the map is clicked on. I want to remove it when the widget closes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oddly enough Dojo docs do not talk about hooking to a widget closing. &lt;/P&gt;&lt;P&gt;I referred to &lt;A href="http://dojotoolkit.org/documentation/tutorials/1.10/understanding_widgetbase/" title="http://dojotoolkit.org/documentation/tutorials/1.10/understanding_widgetbase/"&gt;Understanding _WidgetBase - Dojo Toolkit Tutorial&lt;/A&gt;&amp;nbsp; and &lt;A href="http://dojotoolkit.org/reference-guide/1.10/quickstart/writingWidgets.html" title="http://dojotoolkit.org/reference-guide/1.10/quickstart/writingWidgets.html"&gt;Writing Your Own Widget — The Dojo Toolkit - Reference Guide&lt;/A&gt;&amp;nbsp; etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I found this useful thread, the aspect.after post: &lt;A href="http://stackoverflow.com/questions/29931695/do-dojo-widgets-emit-an-event-when-destroyed-or-can-you-force-one-to" title="http://stackoverflow.com/questions/29931695/do-dojo-widgets-emit-an-event-when-destroyed-or-can-you-force-one-to"&gt;javascript - Do dojo widgets emit an event when destroyed or can you force one to? - Stack Overflow&lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I figured I should be able to just do this code below, right?&amp;nbsp; It doesn't fire. Neither does using this.on or this.own(on&lt;/P&gt;&lt;P&gt;or other Dojo-recommended patterns.&amp;nbsp; And I made sure I required all the right modules etc. No console errors. It just doesn't fire. In terms of where it'd be, it's just inside the "clazz" in my Pictometry widget I posted on here.&amp;nbsp; I'll continue working on this. I want to get this working before posting my widget update which has some of the other new stuff, too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to writing widgets and this is my first so it could likely be something simple. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; startup: function () {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.inherited(arguments);&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pln" style="color: #000000;"&gt;aspect&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;after&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;this&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'destroy'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;()&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; alert('destroyed'); //or..handlerPictometry.remove();&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;true&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 May 2015 20:08:03 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2015-05-14T20:08:03Z</dc:date>
    <item>
      <title>widget question: destroy event?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/widget-question-destroy-event/m-p/787571#M3772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to remove the click handler in my Pictometry widget if the user closes the widget. Regardless whether they've already clicked on the map. (I already have the covered, after the window.open(url), the next line is handlerPictometry.remove() )&amp;nbsp; Because currently the map.on 'click' handler stays active until the map is clicked on. I want to remove it when the widget closes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oddly enough Dojo docs do not talk about hooking to a widget closing. &lt;/P&gt;&lt;P&gt;I referred to &lt;A href="http://dojotoolkit.org/documentation/tutorials/1.10/understanding_widgetbase/" title="http://dojotoolkit.org/documentation/tutorials/1.10/understanding_widgetbase/"&gt;Understanding _WidgetBase - Dojo Toolkit Tutorial&lt;/A&gt;&amp;nbsp; and &lt;A href="http://dojotoolkit.org/reference-guide/1.10/quickstart/writingWidgets.html" title="http://dojotoolkit.org/reference-guide/1.10/quickstart/writingWidgets.html"&gt;Writing Your Own Widget — The Dojo Toolkit - Reference Guide&lt;/A&gt;&amp;nbsp; etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I found this useful thread, the aspect.after post: &lt;A href="http://stackoverflow.com/questions/29931695/do-dojo-widgets-emit-an-event-when-destroyed-or-can-you-force-one-to" title="http://stackoverflow.com/questions/29931695/do-dojo-widgets-emit-an-event-when-destroyed-or-can-you-force-one-to"&gt;javascript - Do dojo widgets emit an event when destroyed or can you force one to? - Stack Overflow&lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I figured I should be able to just do this code below, right?&amp;nbsp; It doesn't fire. Neither does using this.on or this.own(on&lt;/P&gt;&lt;P&gt;or other Dojo-recommended patterns.&amp;nbsp; And I made sure I required all the right modules etc. No console errors. It just doesn't fire. In terms of where it'd be, it's just inside the "clazz" in my Pictometry widget I posted on here.&amp;nbsp; I'll continue working on this. I want to get this working before posting my widget update which has some of the other new stuff, too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to writing widgets and this is my first so it could likely be something simple. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; startup: function () {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.inherited(arguments);&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pln" style="color: #000000;"&gt;aspect&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;after&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;this&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'destroy'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;()&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; alert('destroyed'); //or..handlerPictometry.remove();&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;true&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 20:08:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/widget-question-destroy-event/m-p/787571#M3772</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-05-14T20:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: widget question: destroy event?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/widget-question-destroy-event/m-p/787572#M3773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;For Web AppBuilder, it looks like widgets have an onClose method you could use to do what you are trying to accomplish.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/web-appbuilder/guide/communication-to-app-container.htm" title="https://developers.arcgis.com/web-appbuilder/guide/communication-to-app-container.htm"&gt;Communication to app container—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Granted, I haven't tried this myself, but it might help. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 20:30:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/widget-question-destroy-event/m-p/787572#M3773</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2015-05-14T20:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: widget question: destroy event?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/widget-question-destroy-event/m-p/787573#M3774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh Rene.. thank you. I got so buried in learning Dojo and Widget today.. oops.&amp;nbsp; Yes. This works perfectly and fires the alert:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9.5pt;"&gt;onClose:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;function&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9.5pt;"&gt; () {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;this&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9.5pt;"&gt;.inherited(arguments);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt;"&gt;'close'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9.5pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I knew I had seen onClose somewhere. And then I searched all afternoon for it in Dojo because I thought it was part of Widget. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 20:37:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/widget-question-destroy-event/m-p/787573#M3774</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-05-14T20:37:51Z</dc:date>
    </item>
  </channel>
</rss>

