<?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: Sharing common function between web maps. in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sharing-common-function-between-web-maps/m-p/199774#M18491</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;I put&amp;nbsp; function COL.init() in col_common_SHARED.js&lt;BR /&gt;Then tried to call function COL.init() in Map Service A (mapA.js). &lt;BR /&gt;&lt;BR /&gt;mapA.js&lt;BR /&gt;var function init() = COL.init;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That last line doesn't make sense. If you want to create a variable that points to the COL.init function, you would do this:&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var init = COL.init;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Referring to a function by name gets you a reference to it. Adding parentheses immediately after a function name invokes the function.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 09:57:41 GMT</pubDate>
    <dc:creator>derekswingley1</dc:creator>
    <dc:date>2021-12-11T09:57:41Z</dc:date>
    <item>
      <title>Sharing common function between web maps.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sharing-common-function-between-web-maps/m-p/199773#M18490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We have 3 map services that share common functions e.g. function init(); FinaliseMap = function()....etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The aim is to put the common code into a single file and call the functions as required.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried moving the code to a common file then calling the function from Map A for example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Get an error calling them??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I put&amp;nbsp; function COL.init() in col_common_SHARED.js&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then tried to call function COL.init() in Map Service A (mapA.js). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mapA.js&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var function init() = COL.init;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions what is wrong AND what I should be doing??&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Appreciate any assistance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 08:00:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sharing-common-function-between-web-maps/m-p/199773#M18490</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2012-04-03T08:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sharing common function between web maps.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sharing-common-function-between-web-maps/m-p/199774#M18491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;I put&amp;nbsp; function COL.init() in col_common_SHARED.js&lt;BR /&gt;Then tried to call function COL.init() in Map Service A (mapA.js). &lt;BR /&gt;&lt;BR /&gt;mapA.js&lt;BR /&gt;var function init() = COL.init;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That last line doesn't make sense. If you want to create a variable that points to the COL.init function, you would do this:&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var init = COL.init;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Referring to a function by name gets you a reference to it. Adding parentheses immediately after a function name invokes the function.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:57:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sharing-common-function-between-web-maps/m-p/199774#M18491</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2021-12-11T09:57:41Z</dc:date>
    </item>
  </channel>
</rss>

