<?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: map.enableSnapping() - Async? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447267#M41312</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Awesome, glad it works for you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, I am unable to answer your last question because I honestly have no idea. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have not yet used the snappingManager and am not familiar with its inner workings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I think it is safe to assume that there is a legitimate technical reason for having it this way... but again, I don't know what that reason is.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If someone else could explain, that would be great!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lastly, make sure you mark this thread as 'answered' when you're completely satisfied &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jan 2014 20:54:09 GMT</pubDate>
    <dc:creator>JonathanUihlein</dc:creator>
    <dc:date>2014-01-15T20:54:09Z</dc:date>
    <item>
      <title>map.enableSnapping() - Async?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447264#M41309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am wondering if map.enableSnapping() has any asynchronous processing associated with it and if so are there any events I can listen to or a deferred promise that I can wait for?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I???ve done a bit of testing and it appears that this is the case. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I do the following steps:&lt;/SPAN&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;enable snapping &lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;load in the feature layer (this waits for an ???onUpdateEnd??? event to fire which lets me know the layer is on the map)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;turn on the draw tool &lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;SPAN&gt;Everything works fine however if I change the order to this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;load in the feature layer (this waits for an ???onUpdateEnd??? event to fire which lets me know the layer is on the map)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;enable snapping &lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;turn on the draw tool &lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;SPAN&gt;Snapping does not work on the first draw (it will work on subsequent ones).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 17:56:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447264#M41309</guid>
      <dc:creator>JamieSimko</dc:creator>
      <dc:date>2014-01-15T17:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: map.enableSnapping() - Async?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447265#M41310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Map API Ref:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://developers.arcgis.com/en/javascript/jsapi/map-amd.html" rel="nofollow" target="_blank"&gt;https://developers.arcgis.com/en/javascript/jsapi/map-amd.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"If snapping is enabled on the map using map.enableSnapping() this property provides access to the &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://developers.arcgis.com/en/javascript/jsapi/snappingmanager-amd.html" rel="nofollow" target="_blank"&gt;SnappingManager&lt;/A&gt;&lt;SPAN&gt;."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://developers.arcgis.com/en/javascript/jsapi/snappingmanager-amd.html" rel="nofollow" target="_blank"&gt;https://developers.arcgis.com/en/javascript/jsapi/snappingmanager-amd.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure there's an init or load event for the SnappingManager but you could probably just make sure the SnappingManager is accessable/exists before continuing on in your code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 20:09:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447265#M41310</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2014-01-15T20:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: map.enableSnapping() - Async?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447266#M41311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestion. I tested it out and for my use case it works. It seems strange to me that the snapping manager gets returned when you call map.enableSnapping(). Does anyone know why that would be when you would end up having access to it on the map object when it is truly available anyway?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 20:37:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447266#M41311</guid>
      <dc:creator>JamieSimko</dc:creator>
      <dc:date>2014-01-15T20:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: map.enableSnapping() - Async?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447267#M41312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Awesome, glad it works for you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, I am unable to answer your last question because I honestly have no idea. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have not yet used the snappingManager and am not familiar with its inner workings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I think it is safe to assume that there is a legitimate technical reason for having it this way... but again, I don't know what that reason is.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If someone else could explain, that would be great!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lastly, make sure you mark this thread as 'answered' when you're completely satisfied &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 20:54:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447267#M41312</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2014-01-15T20:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: map.enableSnapping() - Async?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447268#M41313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;map.enableSnapping() is a convenient method. You can achieve the same result by creating a new snappingManager.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 22:45:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447268#M41313</guid>
      <dc:creator>JianHuang</dc:creator>
      <dc:date>2014-01-15T22:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: map.enableSnapping() - Async?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447269#M41314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;would creating a snapping manager and passing in my map as a parameter work any differently or would there still be a delay before snapping is ready?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm assuming that checking for the snapping manager on the map itself is probably the best way to know that it has been setup. Is this correct?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 21:06:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447269#M41314</guid>
      <dc:creator>JamieSimko</dc:creator>
      <dc:date>2014-01-16T21:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: map.enableSnapping() - Async?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447270#M41315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;please, I have similar problem and I would need help to straighten my point of view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN&gt;I'm not sure there's an init or load event for the SnappingManager but you could probably just make sure the SnappingManager is accessable/exists before continuing on in your code.&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Is it really recommended approach? In documentation is stated that after calling the function enableSnapping(), snappingManager is accessible through snappingManager property.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="kwd"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="kwd"&gt;require&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;([&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"esri/map"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;...&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;],&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;function&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;Map&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;...&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;{&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;var&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; map &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;new&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ"&gt;Map&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;...&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;);&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;var&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; snappingManager &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; map&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;snappingManager&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;();&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;...&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;});&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I would expect it to just be there. But unfortunately in reality it works or doesn't work that way. Snapping manager is returned inconsistently. Sometimes yes, sometimes no. Depending on the underlying structures and layers to be ready / loaded I guess.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or, on the other hand, if it ought to be async, the function enableSnapping() should require some callback function as an argument to be called in the moment the snapping manager is created and ready.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or there should be an event on the map object to be listend and handled when snapping manager is ready and accessible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Honestly, I can't imagine any other clean way of making sure the SnappingManager is accessable/exists. Do you? Any setInterval or setTimeout hacks? no...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please can somebody suggest the right approach?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 07:50:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-enablesnapping-async/m-p/447270#M41315</guid>
      <dc:creator>drahoslavlacny</dc:creator>
      <dc:date>2015-01-06T07:50:53Z</dc:date>
    </item>
  </channel>
</rss>

