<?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: dojo/on versus dojo.connect in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45545#M3990</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Derek for your reply. I can tell ESRI is working very hard to make it compatible to AMD 'cause many times when I look at the API, there are some classes starting support dojo/on event style.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Derek, may I ask the reason for the recommendation to use object.on instead of on(object, ..)? Is that because object.on will register the event handler at the object scope, while on(object, ...) will register at the global level?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason Zou&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 May 2013 13:23:11 GMT</pubDate>
    <dc:creator>JasonZou</dc:creator>
    <dc:date>2013-05-23T13:23:11Z</dc:date>
    <item>
      <title>dojo/on versus dojo.connect</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45537#M3982</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;when i try to substitute&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dojo.connect(map, "onLoad) function(){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; // do something;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;};&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;with&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;require(["dojo/on"], function(on){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; on(map, "onLoad", function(){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do something;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dojo throws an error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Target must be an event emitter&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Stephan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 07:05:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45537#M3982</guid>
      <dc:creator>StephanMendler</dc:creator>
      <dc:date>2012-10-24T07:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: dojo/on versus dojo.connect</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45538#M3983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't think (ESRI) JS API objects are compatible with dojo.on yet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/threads/65179-Does-the-JavaScript-API-support-event-handling-via-quot-on-quot-method" rel="nofollow" target="_blank"&gt;http://forums.arcgis.com/threads/65179-Does-the-JavaScript-API-support-event-handling-via-quot-on-quot-method&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dojo.on is dependent on some specific mixins etc. and if you have a look at the Dojo source you'll see that exception is only thrown after a whole bunch of checks and initialisation has been performed.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 08:50:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45538#M3983</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-10-24T08:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: dojo/on versus dojo.connect</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45539#M3984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, i think your are right. In the moment there is a lot of new dojo functionality (dojo/on and the new AMD pattern etc.) which is not yet (or just partially) implemented in the current Javascript API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your answer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 14:03:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45539#M3984</guid>
      <dc:creator>StephanMendler</dc:creator>
      <dc:date>2012-10-24T14:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: dojo/on versus dojo.connect</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45540#M3985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This seems to still be the case.&amp;nbsp; We are working on creating a Dojo 2.0, fully AMD-compatible application.&amp;nbsp; The &lt;/SPAN&gt;&lt;A href="http://dojotoolkit.org/reference-guide/1.8/dojo/connect.html" rel="nofollow noopener noreferrer" target="_blank"&gt;documentation&lt;/A&gt;&lt;SPAN&gt; states that in addition to "dojo/on", "dojo/aspect" is another option.&amp;nbsp; And event handlers, using dojo/aspect, do get called.&amp;nbsp; However, the handler arguments are not available.&amp;nbsp; For example, in the snippet below, "layer" is undefined:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;aspect.after(this.map, "onLayerAddResult", lang.hitch(this, function (layer, error) {

}));&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:46:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45540#M3985</guid>
      <dc:creator>JimSomerville</dc:creator>
      <dc:date>2021-12-10T21:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: dojo/on versus dojo.connect</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45541#M3986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Connect and Aspect work off execution of method. So in the API, there is a method called onLayerAddResult() that is executed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is an older explanation of how these work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://dojotoolkit.org/documentation/tutorials/1.6/events/"&gt;http://dojotoolkit.org/documentation/tutorials/1.6/events/&lt;/A&gt;&lt;SPAN&gt; &amp;lt;- added a better reference&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order for dojo.on to capture an event, the object, in this case the "map" would need to extend dojo/Evented and emit a custom event in the code somewhere by doing something like&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;this.emit('onLayerAddResult', {layer:layerObject, error:errorMessage})&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This still isn't 100% in the API yet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;At the moment, esri.Map does extend dojo/Evented. You can test it by doing this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map.on('click', function(e) {console.log(e)});&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It just doesn't emit all the custom events yet, but it works for DOM events.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 17:39:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45541#M3986</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2013-03-11T17:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: dojo/on versus dojo.connect</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45542#M3987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;just a side note, make sure when using on to remove "on" from the actual event name.&amp;nbsp; example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;on(map, "onLoad", function(){&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;should really be&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;on(map, "Load", function(){&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 18:10:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45542#M3987</guid>
      <dc:creator>JoshuaFix</dc:creator>
      <dc:date>2013-04-08T18:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: dojo/on versus dojo.connect</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45543#M3988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can any ESRI staff answer the question? In what scope the JS API is compatible with dojo/on? Does ESRI have a timeline to fully support dojo/on and other dojo 1.8 features? It is annoying to mix using dojo.connect and dojo/on in the same application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason Zou&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2013 15:44:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45543#M3988</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2013-04-11T15:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: dojo/on versus dojo.connect</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45544#M3989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Can any ESRI staff answer the question? In what scope the JS API is compatible with dojo/on? Does ESRI have a timeline to fully support dojo/on and other dojo 1.8 features? It is annoying to mix using dojo.connect and dojo/on in the same application.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As of version 3.4, classes in the JS API are not compatible with dojo/on. The exception is the Map class but we haven't doc'ed this because we want to be able to say we support dojo/on across the entire API rather than doing it piece by piece. We are still working on it...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When it's finished, we'll encourage you to do object.on("event-name", callback); rather than on(object, "event-name", callbcak); but that will be up to you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2013 17:07:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45544#M3989</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2013-04-11T17:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: dojo/on versus dojo.connect</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45545#M3990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Derek for your reply. I can tell ESRI is working very hard to make it compatible to AMD 'cause many times when I look at the API, there are some classes starting support dojo/on event style.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Derek, may I ask the reason for the recommendation to use object.on instead of on(object, ..)? Is that because object.on will register the event handler at the object scope, while on(object, ...) will register at the global level?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason Zou&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 13:23:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45545#M3990</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2013-05-23T13:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: dojo/on versus dojo.connect</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45546#M3991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Derek, may I ask the reason for the recommendation to use object.on instead of on(object, ..)? Is that because object.on will register the event handler at the object scope, while on(object, ...) will register at the global level?&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using on(object, event, callback) shouldn't be any different than using object.on(event, callback). My recommendation was purely from a readability point of view�?? I find object.on style code easier to read.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also note that as of &lt;/SPAN&gt;&lt;A href="http://developers.arcgis.com/en/javascript/jshelp/whats_new.html"&gt;version 3.5&lt;/A&gt;&lt;SPAN&gt; esri/map and everything in esri/layers and esri/tasks now has .on style events.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 15:05:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-on-versus-dojo-connect/m-p/45546#M3991</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2013-05-23T15:05:18Z</dc:date>
    </item>
  </channel>
</rss>

