<?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: calling functions from html script, using AMD syntax in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752850#M69579</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for the responses.&amp;nbsp; They are a help.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I'm trying to do is to pass arguments into a function from various checkboxes (each with their own set of arguments), Is there a way to do that using AMD?&amp;nbsp; Just to explain the situation a bit more: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;require ({.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;function X (takes arguments a, b)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;)};&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;html section&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;checkbox 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -----function X (argument1a , argument 1b)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;checkbox 2&amp;nbsp;&amp;nbsp; ------ function X (argument2a, argument 2b)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Sep 2013 21:02:34 GMT</pubDate>
    <dc:creator>DavidMarquardt</dc:creator>
    <dc:date>2013-09-04T21:02:34Z</dc:date>
    <item>
      <title>calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752847#M69576</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;I???m having problems adjusting my functions to the AMD syntax.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have some html checkboxes that call a update visibility function.&amp;nbsp; I have some scripting in the html code that passes on unique arguments to the function.&amp;nbsp; In the legacy script, this worked fine.&amp;nbsp; When I transferred over to the AMD syntax (putting all functions inside the AMD require statement), the update visibility function is not recognized by the html code. But, if I take the function out of the require statement, the html scripting recognizes it.&amp;nbsp; In this situation, though, the update visibility function can't recognize any of the modules or elements left in the require statement.&amp;nbsp;&amp;nbsp; How do I call a function from an html script that's inside the require statement?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here???s the stripped down format I have that doesn???t work&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;lt;script src="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://js.arcgis.com/3.6/" rel="nofollow" target="_blank"&gt;http://js.arcgis.com/3.6/&lt;/A&gt;&lt;SPAN&gt;" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;script&amp;nbsp; type="text/javascript"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;require([ a bunch of modules ], function ( modules) { &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ready (function() {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; map = ???..&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function updateLayerVisibility (arg1, arg2) { ???..}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;body&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;input type='checkbox' class='list_item' id='foodLyr3' value=3 onclick='updateLayerVisibility(arg1, arg2);'&amp;nbsp; /&amp;gt;&amp;lt;/input&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/body&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Sep 2013 19:00:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752847#M69576</guid>
      <dc:creator>DavidMarquardt</dc:creator>
      <dc:date>2013-09-04T19:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752848#M69577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function updateLayerVisibility (arg1, arg2) {
&amp;nbsp; // only need to use require when updateLayerVisibility depends on module1, module2,...
&amp;nbsp; require([module1, module2,...], function (module1, module2, ...) { 
&amp;nbsp;&amp;nbsp;&amp;nbsp; // code for updateLayerVisibility 
&amp;nbsp; });
} &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AMD encourages to define modules to wrap the functionalities. It's kind of awkward to define the functions in the legacy way, and trying to make use of AMD to load the dependencies asynchronously.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:57:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752848#M69577</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2021-12-12T07:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752849#M69578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What you need to do&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;Remove the "onclick" attribute of the checkbox input element.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Inside the &lt;SPAN style="font-style:italic;"&gt;require&lt;/SPAN&gt; function call &lt;A href="http://dojotoolkit.org/reference-guide/1.9/dojo/on.html"&gt;dojo/on&lt;/A&gt; to connect the checkbox to the event handler function. (If you don't need to deal with legacy browsers you should use the built in JavaScript &lt;A href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener"&gt;addEventListener&lt;/A&gt; function instead of dojo/on.)&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Sep 2013 19:24:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752849#M69578</guid>
      <dc:creator>JeffJacobson</dc:creator>
      <dc:date>2013-09-04T19:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752850#M69579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for the responses.&amp;nbsp; They are a help.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I'm trying to do is to pass arguments into a function from various checkboxes (each with their own set of arguments), Is there a way to do that using AMD?&amp;nbsp; Just to explain the situation a bit more: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;require ({.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;function X (takes arguments a, b)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;)};&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;html section&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;checkbox 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -----function X (argument1a , argument 1b)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;checkbox 2&amp;nbsp;&amp;nbsp; ------ function X (argument2a, argument 2b)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Sep 2013 21:02:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752850#M69579</guid>
      <dc:creator>DavidMarquardt</dc:creator>
      <dc:date>2013-09-04T21:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752851#M69580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thank you for the responses.&amp;nbsp; They are a help.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;What I'm trying to do is to pass arguments into a function from various checkboxes (each with their own set of arguments), Is there a way to do that using AMD?&amp;nbsp; Just to explain the situation a bit more: &lt;BR /&gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;&lt;BR /&gt;require ({.....&lt;BR /&gt;&lt;BR /&gt;function X (takes arguments a, b)&lt;BR /&gt;&lt;BR /&gt;)};&lt;BR /&gt;&lt;BR /&gt;&amp;lt;html section&amp;gt;&lt;BR /&gt;&lt;BR /&gt;checkbox 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -----function X (argument1a , argument 1b)&lt;BR /&gt;checkbox 2&amp;nbsp;&amp;nbsp; ------ function X (argument2a, argument 2b)&lt;BR /&gt;&lt;BR /&gt;David&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, Jeff explained how to connect an event in the post above yours (copied below):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What you need to do&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;Inside the &lt;SPAN style="font-style:italic;"&gt;require&lt;/SPAN&gt; function call &lt;A href="http://dojotoolkit.org/reference-guide/1.9/dojo/on.html"&gt;dojo/on&lt;/A&gt; to connect the checkbox to the event handler function. (If you don't need to deal with legacy browsers you should use the built in JavaScript &lt;A href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener"&gt;addEventListener&lt;/A&gt; function instead of dojo/on.)&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Check out the 'dojo/on' documentation for a bit; you should be able to find everything you need.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Sep 2013 21:10:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752851#M69580</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2013-09-04T21:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752852#M69581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeff's overall idea is better than mine. Here is what I would do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Define an app controller module, module/app.js.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;define(["dojo/_base/lang", "dojo/dom", "dojo/on", ...], function(lang, dom, on, ...) {
&amp;nbsp; return {
&amp;nbsp;&amp;nbsp;&amp;nbsp; init: function() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on(dom.byId("chkbox1_ID"), "change", lang.hitch(this, function(evt) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.chk1_onChange(evt, param1, param2);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }));
&amp;nbsp;&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp;&amp;nbsp; chk1_onChange: function(evt, param1, param2) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // respond to the event
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp; };
});&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Inside the index.htm,&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; &amp;lt;script&amp;gt;
&amp;nbsp; var dojoConfig = {
&amp;nbsp;&amp;nbsp; parseOnLoad: true,
&amp;nbsp;&amp;nbsp; async: true,
&amp;nbsp;&amp;nbsp; packages: [{
&amp;nbsp;&amp;nbsp;&amp;nbsp; name: "module",
&amp;nbsp;&amp;nbsp;&amp;nbsp; location: "/path/to/module"
&amp;nbsp;&amp;nbsp; }]
&amp;nbsp; };
 &amp;lt;/script&amp;gt;
 &amp;lt;script src="http://js.arcgis.com/3.6/"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;script&amp;gt;
&amp;nbsp; require(["module/app", "dojo/domReady!"], function(app) {
&amp;nbsp;&amp;nbsp; app.init();
&amp;nbsp; });
 &amp;lt;/script&amp;gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can define all the event handlers in app.js so to keep HTML for the page layout, and JS file for the business logic.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:57:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752852#M69581</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2021-12-12T07:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752853#M69582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks zj_zou and Jeff, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From what you're saying, I should just establish my parameters in the event handler (since I have 8 sets of parameters, I'll end up with 8 event handlers).&amp;nbsp; From there, I'll pass it on to the update visibility function.&amp;nbsp; I had hoped to set parameters within their respective checkboxes, but I'll avoid doing that and keep the html separate from the scripting.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just curious, though, is there a way to call a function outside of its own require statement?&amp;nbsp; I take it making global functions gets messy very quickly, and shouldn't be done, but it's good to know if it is possible to do in the new AMD format. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 14:49:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752853#M69582</guid>
      <dc:creator>DavidMarquardt</dc:creator>
      <dc:date>2013-09-05T14:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752854#M69583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks zj_zou and Jeff, &lt;BR /&gt;since I have 8 sets of parameters, I'll end up with 8 event handlers&lt;BR /&gt;David&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;While you could have eight event handlers, you could probably get away with one event handler for all checkbox elements (assuming all checkbox elements on the page have the same functionality with different params to pass).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could identify the parameters depending on which checkbox was clicked, inside the single event handler, then pass that along to your update function.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 14:55:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752854#M69583</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2013-09-05T14:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752855#M69584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Just curious, though, is there a way to call a function outside of its own require statement?&amp;nbsp; I take it making global functions gets messy very quickly, and shouldn't be done, but it's good to know if it is possible to do in the new AMD format. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think this would do that...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;require(function() { &amp;nbsp; function myFunc() { &amp;nbsp; } &amp;nbsp;&amp;nbsp; &amp;nbsp; // Assign the function to window so it is globally available. &amp;nbsp; window.myFunc = myFunc; });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 15:32:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752855#M69584</guid>
      <dc:creator>JeffJacobson</dc:creator>
      <dc:date>2013-09-05T15:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752856#M69585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You should be able to just have one function handle all of the checkboxes if they are all basically doing the same thing but affecting a different layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Inside of your event handler function, the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;this&lt;/SPAN&gt;&lt;SPAN&gt; keyword will be pointing to the checkbox that was clicked. You can use that to access the attributes of the checkbox (HTML input element). You can have a &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;data-layer-id attribute&lt;/SPAN&gt;&lt;SPAN&gt;, for example.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 15:41:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752856#M69585</guid>
      <dc:creator>JeffJacobson</dc:creator>
      <dc:date>2013-09-05T15:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752857#M69586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you all for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I redesigned my code based on your advice.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good to know there is a way to make a function accessible, if necessary. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 16:46:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752857#M69586</guid>
      <dc:creator>DavidMarquardt</dc:creator>
      <dc:date>2013-09-05T16:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: calling functions from html script, using AMD syntax</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752858#M69587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had exactly the same question. Thanks Jeff.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2016 16:12:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calling-functions-from-html-script-using-amd/m-p/752858#M69587</guid>
      <dc:creator>feliperivera</dc:creator>
      <dc:date>2016-10-26T16:12:41Z</dc:date>
    </item>
  </channel>
</rss>

