<?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 JS functions names collision in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/js-functions-names-collision/m-p/747181#M69130</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to use&amp;nbsp; ArcGIS JavaScript map component on the same page with &lt;A class="link-titled" href="https://xdsoft.net/jodit/" title="https://xdsoft.net/jodit/"&gt;Jodit WYSIWYG HTML editor&lt;/A&gt;. Both components use obfuscated JavaScript code. The problem is that the obfuscated code of both components uses the same replacements for functions names, which leads to collision. For example, both codes contain a top level function named "O". As the result, a call to the function leads to a wrong code (it depends on the order of loading of JavaScript files). On my opinion, the problem could be solved by using namespaces in your source JavaScript files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Mar 2019 10:03:19 GMT</pubDate>
    <dc:creator>MarkKovler</dc:creator>
    <dc:date>2019-03-28T10:03:19Z</dc:date>
    <item>
      <title>JS functions names collision</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/js-functions-names-collision/m-p/747181#M69130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to use&amp;nbsp; ArcGIS JavaScript map component on the same page with &lt;A class="link-titled" href="https://xdsoft.net/jodit/" title="https://xdsoft.net/jodit/"&gt;Jodit WYSIWYG HTML editor&lt;/A&gt;. Both components use obfuscated JavaScript code. The problem is that the obfuscated code of both components uses the same replacements for functions names, which leads to collision. For example, both codes contain a top level function named "O". As the result, a call to the function leads to a wrong code (it depends on the order of loading of JavaScript files). On my opinion, the problem could be solved by using namespaces in your source JavaScript files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2019 10:03:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/js-functions-names-collision/m-p/747181#M69130</guid>
      <dc:creator>MarkKovler</dc:creator>
      <dc:date>2019-03-28T10:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: JS functions names collision</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/js-functions-names-collision/m-p/747182#M69131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;3x or 4x?&amp;nbsp;I can't think of any global functions in the JSAPI. The only method names that are obfuscated during the optimization process like that are names that scoped in a function, for example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="token function"&gt;require&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"m1"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"m2"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"m3"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; b&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; c&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;// scoped to this function, not global&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;// sometime later when it is used&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; a2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;a&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arg&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No namespacing required.&lt;/P&gt;&lt;P&gt;They should have no conflicts with any other libraries. If there are conflicts with that library it could be they are obfuscating global function names.I would think they would just shadow it though. Tough to tell.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:46:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/js-functions-names-collision/m-p/747182#M69131</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-12T07:46:23Z</dc:date>
    </item>
  </channel>
</rss>

