title: Chaining dojo.connect
body: <p>I have found that you cannot chain connects with consistent behavior.  In the code below, the onCustomClick method in the widget is called, but the function that is connected to it does not get called.  The workaround I have, is what I have done with onCustomClick2 where I attach the event to an internal method that simply calls the other method.  Is there a way to write this code without having to have the internal method?</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Dojo Connect Issue&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div id="content"&gt;&lt;/div&gt;
  
  &lt;script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7/dojo/dojo.js" data-dojo-config="isDebug: true"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      require(["dojo/domReady!", "dojo/parser", "dijit/_Widget", "dijit/_Templated"], function(dr, p, w, t) {
  
          dojo.declare("W1", [w, t], {
  
              templateString: '&lt;div&gt;Click Me&lt;/div&gt;',
  
              postCreate: function() {
                  this.inherited(arguments);
                  this.connect(this.domNode, 'onclick', this.onCustomClick);
                  this.connect(this.domNode, 'onclick', this._onCustomClick2);
              },
  
              onCustomClick: function() {
                  console.debug('onCustomClick');
              },
  
              _onCustomClick2: function() {
                  this.onCustomClick2();
              },
  
              onCustomClick2: function() {
                  console.debug('onCustomClick2');
              },
          });
  
          var w = new W1({}, dojo.byId('content'));
  
          dojo.connect(w, 'onCustomClick', function() {
              console.debug('End Consumer - onCustomClick'); // never gets called???
          });
          dojo.connect(w, 'onCustomClick2', function() {
              console.debug('End Consumer - onCustomClick2');
          });
          w.startup();
  
      }); 
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>