<?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: custom widget examples not working? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1013456#M71268</link>
    <description>&lt;P&gt;Thanks Anne, I look forward to hearing what you all come up with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--john&lt;/P&gt;</description>
    <pubDate>Sun, 03 Jan 2021 18:05:06 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-01-03T18:05:06Z</dc:date>
    <item>
      <title>custom widget examples not working?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1012359#M71193</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I was following the examples for creating a custom widget &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-custom-widget/index.html" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;and &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-custom-recenter/index.html" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;including the Typescript &lt;A href="https://developers.arcgis.com/javascript/latest/guide/typescript-setup/index.html" target="_self"&gt;setup&lt;/A&gt;&amp;nbsp;instructions.&amp;nbsp; When I try to load the widget however, I get the error:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Uncaught TypeError: HelloWorld is not a constructor&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;In comparing to the source for one of the &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-custom-recenter/live/index.html" target="_self"&gt;View Live&lt;/A&gt;&amp;nbsp;demos, I notice the JavaScript looks different than my compiled version.&amp;nbsp; I'm assuming that this has to do with the version of TypeScript used or the target property in tsconfig.json but my experiments with different versions of TypeScript and target versions have been unsuccessful.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;Can someone please help me with getting the examples in the User Guide to work?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;Thanks!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;--john&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Dec 2020 17:55:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1012359#M71193</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-12-26T17:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: custom widget examples not working?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1013015#M71249</link>
      <description>&lt;P&gt;Hi John! Thanks for pointing this out. We are investigating why the tutorial is not working as expected. I will update you when we have more information!&lt;/P&gt;&lt;P&gt;- Anne&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 19:31:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1013015#M71249</guid>
      <dc:creator>AnneFitz</dc:creator>
      <dc:date>2020-12-30T19:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: custom widget examples not working?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1013456#M71268</link>
      <description>&lt;P&gt;Thanks Anne, I look forward to hearing what you all come up with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--john&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jan 2021 18:05:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1013456#M71268</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-01-03T18:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: custom widget examples not working?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1013674#M71276</link>
      <description>&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;There are a few changes you'll need to make in order for this to work.&lt;/P&gt;&lt;P&gt;1. Add the following to compilerOptions in your tsconfig.json file&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;"lib": ["ES2019", "DOM"]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;2. In your require statement in the index.html file, use this syntax to reference the custom widget:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require(["app/HelloWorld"], 
  function({default: HelloWorld}) { } &lt;/LI-CODE&gt;&lt;P&gt;By following the rest of the tutorial but making these small changes, I was able to get these samples to work. Let me know if you still run into any issues! We are working on updating the documentation to reflect these changes.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Anne&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2021 18:38:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1013674#M71276</guid>
      <dc:creator>AnneFitz</dc:creator>
      <dc:date>2021-01-04T18:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: custom widget examples not working?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1015395#M71351</link>
      <description>&lt;P&gt;Thanks Anne.&amp;nbsp; I must still be missing something because, I'm getting this error:&lt;/P&gt;&lt;P&gt;(index):120 Uncaught TypeError: Class constructor HelloWorld cannot be invoked without 'new'&lt;BR /&gt;at new g ((index):120)&lt;BR /&gt;at (index):50&lt;BR /&gt;at Sa ((index):47)&lt;BR /&gt;at (index):48&lt;BR /&gt;at Ka ((index):47)&lt;BR /&gt;at sa ((index):48)&lt;BR /&gt;at qa ((index):50)&lt;BR /&gt;at HTMLScriptElement.&amp;lt;anonymous&amp;gt; ((index):52)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got my source in &lt;A href="https://github.com/jccartwright/jsapi-custom-widget-sample" target="_blank" rel="noopener"&gt;Github&lt;/A&gt;&amp;nbsp;but did notice that the generated JS shown in the &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-custom-widget/index.html" target="_blank" rel="noopener"&gt;tutorial&lt;/A&gt; doesn't match what I'm getting out of &lt;FONT face="terminal,monaco"&gt;tsc&lt;/FONT&gt; so perhaps there's still a mismatch in the &lt;FONT face="terminal,monaco"&gt;tsconfig.json&lt;/FONT&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jan 2021 20:57:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1015395#M71351</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-01-10T20:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: custom widget examples not working?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1015628#M71359</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User&amp;nbsp;- sorry about the confusion. Try setting your target to "es5" in the tsconfig instead of "es2019".&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 17:27:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1015628#M71359</guid>
      <dc:creator>AnneFitz</dc:creator>
      <dc:date>2021-01-11T17:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: custom widget examples not working?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1015750#M71361</link>
      <description>&lt;P&gt;Thanks, that does seem to fix it.&amp;nbsp; Should that be the standard target in the tsconfig.json and the docs adjusted accordingly?&lt;/P&gt;&lt;P&gt;My eventual objective is to be able to write custom accessor-based widgets and to use w/ the new ESM support but I've been unable to incorporate this sample widget into the ESM (e.g. create-react-app) samples.&amp;nbsp; Do you have any docs/examples/guidance on doing that?&amp;nbsp; Just changing the "module":"ES6" in tsconfig and updating the import statements was not enough.&lt;/P&gt;&lt;P&gt;Thanks again for your help!&lt;/P&gt;&lt;P&gt;--john&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 21:37:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-examples-not-working/m-p/1015750#M71361</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-01-11T21:37:51Z</dc:date>
    </item>
  </channel>
</rss>

