<?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: Unable to access zoom level outside watchUtils.watch in ESRI in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-access-zoom-level-outside-watchutils/m-p/1032834#M71929</link>
    <description>&lt;P&gt;You have to use &lt;A href="https://dojotoolkit.org/reference-guide/1.10/dojo/_base/lang.html#hitch" target="_self"&gt;lang.hitch&lt;/A&gt; to make sure "this" is retaining the correct context when being used in the function&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;watchUtils.watch(this.mapView, "zoom", lang.hitch(this, function (zoom) {
  this.zoomLevel = zoom;
}));&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 04 Mar 2021 13:27:48 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2021-03-04T13:27:48Z</dc:date>
    <item>
      <title>Unable to access zoom level outside watchUtils.watch in ESRI</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-access-zoom-level-outside-watchutils/m-p/1032794#M71927</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;My code is like below&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;watchUtils&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;watch&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;this&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;mapView&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"zoom"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;zoom&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;this.zoomLevel = zoom;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I want to access this.zoomLevel outside the watchUtils block as and when it is triggered.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;But it is giving undefined.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;PS: I have tried getter setter methods, and this.zoomLevel is declared globally.still facing the issue.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can anyone suggest the solution?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Mar 2021 10:08:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-access-zoom-level-outside-watchutils/m-p/1032794#M71927</guid>
      <dc:creator>MahaK</dc:creator>
      <dc:date>2021-03-04T10:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to access zoom level outside watchUtils.watch in ESRI</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-access-zoom-level-outside-watchutils/m-p/1032834#M71929</link>
      <description>&lt;P&gt;You have to use &lt;A href="https://dojotoolkit.org/reference-guide/1.10/dojo/_base/lang.html#hitch" target="_self"&gt;lang.hitch&lt;/A&gt; to make sure "this" is retaining the correct context when being used in the function&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;watchUtils.watch(this.mapView, "zoom", lang.hitch(this, function (zoom) {
  this.zoomLevel = zoom;
}));&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 Mar 2021 13:27:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-access-zoom-level-outside-watchutils/m-p/1032834#M71929</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-03-04T13:27:48Z</dc:date>
    </item>
  </channel>
</rss>

