<?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 do I disable Sketch widget from onCreate complete in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-disable-sketch-widget-from-oncreate/m-p/1358266#M83059</link>
    <description>&lt;P&gt;Creation Mode is continuous by default.&amp;nbsp; Use single.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const sketch = new Sketch({
  layer: sketchGraphicsLayer,
  view: mapView,
  creatioMode: "single"
})&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 07 Dec 2023 20:34:59 GMT</pubDate>
    <dc:creator>MatthewDriscoll</dc:creator>
    <dc:date>2023-12-07T20:34:59Z</dc:date>
    <item>
      <title>How do I disable Sketch widget from onCreate complete</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-disable-sketch-widget-from-oncreate/m-p/1356497#M83004</link>
      <description>&lt;P&gt;I would like to disable the Sketch widget in the onCreate handle for state "complete".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do it via&amp;nbsp;.destroy(); inside the handler, I get the following error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;SketchViewModel.js:5 Uncaught (in promise) s {name: 'AbortError', details: undefined, message: 'Aborted'}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only way I found to work is to fire the .destroy() after a timeout. Is there a better way?&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;const handleOnCreate = (event) =&amp;gt; {
	if (event.state === 'complete') {
	  // my processing 

	  //setTimeout(() =&amp;gt; {
	  currentSketch?.destroy();
	  //}, 200);
	}
};


const sketchGraphicsLayer = mapView.map.findLayerById(layerName);
const sketch = new Sketch({
  layer: sketchGraphicsLayer,
  view: mapView,
});

sketch.on('create', function (event) {
  handleOnCreate(event);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 19:25:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-disable-sketch-widget-from-oncreate/m-p/1356497#M83004</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2023-12-04T19:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I disable Sketch widget from onCreate complete</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-disable-sketch-widget-from-oncreate/m-p/1358266#M83059</link>
      <description>&lt;P&gt;Creation Mode is continuous by default.&amp;nbsp; Use single.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const sketch = new Sketch({
  layer: sketchGraphicsLayer,
  view: mapView,
  creatioMode: "single"
})&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Dec 2023 20:34:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-disable-sketch-widget-from-oncreate/m-p/1358266#M83059</guid>
      <dc:creator>MatthewDriscoll</dc:creator>
      <dc:date>2023-12-07T20:34:59Z</dc:date>
    </item>
  </channel>
</rss>

