Are there trade offs when using jQuery's on/trigger support in non DOM objects?
<p>Example below shows two common, modern, approaches for providing event handling in a custom JavaScript object. (I think.) The example is based on the common scenario of loading data in jQuery via AJAX, where a parameter is passed in that also needs to be provided in the eventual completed event that gets published.</p>

<pre><code>CustomClass.prototype.loadData(param1) {

  var thisObj = this;
  $.ajax({
    url : this.reqUrl,
    context: this,

    // There are various ways to do this, including writing the handlers inline
    // or using $.proxy. Shouldn't be important for this question.
    success : function(dataResp, textStatus) {thisObj.onSuccess(dataResp,
                                                                textStatus,
                                                                param1)}
  });
};

// Manage listeners. Storing functions here, but
// could also use objects with predefined functions.
CustomClass.prototype.addListener(callbackFunc) {
  this.listeners.Add(callbackFunc);
}

CustomClass.prototype.onSuccess(dataResp, textStatus, param1) {

  //**OPTION 1**
  // Publish event via callbacks/listeners
  for(var i=0; i&lt;this.listeners; i++)
    this.listeners[i](dataResp, param1);

  //**OPTION 2**
  // Publish event via trigger/on
  $(this).trigger('my-event-name', [dataResp, param1]);

};
</code></pre>

<p>Following shows how these two options would look in code:</p>

<pre><code>function handler(dataResp, param1) {
  // do work, param1 == 'whatever'
}

c1 = new CustomClass();
c1.addListener(handler);
c1.loadData('whatever');

c2 = new CustomClass();
$(c2).on('my-event-name', handler);
c2.loadData('whatever');
</code></pre>

<p>The result is the same with either option above. Using jquery's on/trigger support removes need to have code for managing listeners, but:</p>

<ul>
<li><strong>Is one approach definitely better than the other?</strong></li>
<li><strong>Are there any significant tradeoffs when using on/trigger, such as performance?</strong></li>
</ul>

<p>There are many questions/answers on SO regarding the benefits of using event listener style programming with DOM elements.  And there are many questions/answers regarding various ways to provide event handling in non DOM objects. However, I couldn't find anything definitive regarding <em>preferred</em> approach for non DOM objects and the potential tradeoffs, especially in non-trivial use cases such as example above.  </p>

<p>EDIT
...of course after posting, I see that <a href="http://stackoverflow.com/questions/9895468/what-is-the-pitfall-in-using-jquery-on-off-and-trigger-method-on-non-dom-element?rq=1">this question/answer</a> comes (very) close. However, it does not indicate if there are any other ramifications besides adding additional properties to the custom object. Also, I believe my question provides a clearer use case.</p>
