<?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: Best method using ESRI Loader for click events in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-method-using-esri-loader-for-click-events/m-p/622927#M58160</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Hey Paul, note we recommend asking questions for esri-loader over on its github issues page:&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/esri-loader/issues" title="https://github.com/Esri/esri-loader/issues"&gt;Issues · Esri/esri-loader · GitHub&lt;/A&gt;. This helps us keep track of related issues.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;SPAN&gt;&amp;gt;&amp;gt; My question is: what is the preferred method to load Esri Modules that will be used in other methods; for example in a click event handler.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;SPAN&gt;This depends on the JavaScript framework such as Vue, React or Angular. Here's a &lt;A href="https://github.com/Esri/angular-cli-esri-map/blob/master/src/app/esri-map/esri-map.component.ts#L37-L49"&gt;getter/setter example&lt;/A&gt; in Angular. Sometimes it's also based on developer preference, sometimes it's a design requirement.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;gt;&amp;gt; Should the modules all be loaded at initialization?&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Also depends on how you are using esri-loader and your requirements. If you are using a JavaScript framework we recommend waiting until the framework has initialized. Here's an Angular example that waits until the &lt;A href="https://github.com/Esri/angular-cli-esri-map/blob/master/src/app/esri-map/esri-map.component.ts#L101"&gt;ngOnInit() event&lt;/A&gt;. If you have a large application that loads many modules up front, it may be worth the effort to determine&amp;nbsp;if any modules can be lazy loaded later to keep your initial loading time as fast as possible.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;gt;&amp;gt; What is the best way to make modules available to other methods in the class?&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Typically this would be the same as any another other JavaScript-based&amp;nbsp;application.&amp;nbsp;All variables will have to be within the JavaScript scope&amp;nbsp;in order to be correctly referenced within a method. How you scope the variables will depend on the framework. Here's&amp;nbsp;a&amp;nbsp; &lt;A href="https://reactjs.org/docs/jsx-in-depth.html#react-must-be-in-scope"&gt;React doc that talks about scoping&lt;/A&gt;.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;gt;&amp;gt; Should the modules be loaded in each method?&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;As I mentioned above, we typically call this lazy loading.&amp;nbsp;This approach is perfectly acceptable&amp;nbsp;if you need to tweak the performance during application initialization. You'll need to examine the cost/benefit of this approach depending on&amp;nbsp;your use cases. You may end up with a combination of loading modules at initialization and lazy loading others.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jul 2018 15:35:04 GMT</pubDate>
    <dc:creator>AndyGup</dc:creator>
    <dc:date>2018-07-24T15:35:04Z</dc:date>
    <item>
      <title>Best method using ESRI Loader for click events</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-method-using-esri-loader-for-click-events/m-p/622926#M58159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am following the ESRI Loader example found &lt;A href="https://github.com/Esri/angular-cli-esri-map"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; [&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;EsriMap&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;EsriMapView&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;Point&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;await&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;loadModules&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;([&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;'esri/Map'&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;'esri/views/MapView'&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;'esri/geometry/Point'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; ]);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is: what is the preferred method to load Esri Modules that will be used in other methods; for example in a click event handler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should the modules all be loaded at initialization? &amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the best way to make modules available to other methods in the class?&lt;/P&gt;&lt;P&gt;Should the modules be loaded in each method?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2018 16:39:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-method-using-esri-loader-for-click-events/m-p/622926#M58159</guid>
      <dc:creator>PaulGiard</dc:creator>
      <dc:date>2018-07-23T16:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Best method using ESRI Loader for click events</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-method-using-esri-loader-for-click-events/m-p/622927#M58160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Hey Paul, note we recommend asking questions for esri-loader over on its github issues page:&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/esri-loader/issues" title="https://github.com/Esri/esri-loader/issues"&gt;Issues · Esri/esri-loader · GitHub&lt;/A&gt;. This helps us keep track of related issues.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;SPAN&gt;&amp;gt;&amp;gt; My question is: what is the preferred method to load Esri Modules that will be used in other methods; for example in a click event handler.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;SPAN&gt;This depends on the JavaScript framework such as Vue, React or Angular. Here's a &lt;A href="https://github.com/Esri/angular-cli-esri-map/blob/master/src/app/esri-map/esri-map.component.ts#L37-L49"&gt;getter/setter example&lt;/A&gt; in Angular. Sometimes it's also based on developer preference, sometimes it's a design requirement.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;gt;&amp;gt; Should the modules all be loaded at initialization?&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Also depends on how you are using esri-loader and your requirements. If you are using a JavaScript framework we recommend waiting until the framework has initialized. Here's an Angular example that waits until the &lt;A href="https://github.com/Esri/angular-cli-esri-map/blob/master/src/app/esri-map/esri-map.component.ts#L101"&gt;ngOnInit() event&lt;/A&gt;. If you have a large application that loads many modules up front, it may be worth the effort to determine&amp;nbsp;if any modules can be lazy loaded later to keep your initial loading time as fast as possible.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;gt;&amp;gt; What is the best way to make modules available to other methods in the class?&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Typically this would be the same as any another other JavaScript-based&amp;nbsp;application.&amp;nbsp;All variables will have to be within the JavaScript scope&amp;nbsp;in order to be correctly referenced within a method. How you scope the variables will depend on the framework. Here's&amp;nbsp;a&amp;nbsp; &lt;A href="https://reactjs.org/docs/jsx-in-depth.html#react-must-be-in-scope"&gt;React doc that talks about scoping&lt;/A&gt;.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;gt;&amp;gt; Should the modules be loaded in each method?&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;As I mentioned above, we typically call this lazy loading.&amp;nbsp;This approach is perfectly acceptable&amp;nbsp;if you need to tweak the performance during application initialization. You'll need to examine the cost/benefit of this approach depending on&amp;nbsp;your use cases. You may end up with a combination of loading modules at initialization and lazy loading others.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2018 15:35:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/best-method-using-esri-loader-for-click-events/m-p/622927#M58160</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2018-07-24T15:35:04Z</dc:date>
    </item>
  </channel>
</rss>

