B2G/gecko/browser/devtools/scratchpad/scratchpad.js
/**
   * Trigger named handlers in Scratchpad observers.
   *
   * @param string aName
   *        Name of the handler to trigger.
   * @param Array aArgs
   *        Optional array of arguments to pass to the observer(s).
   * @see addObserver
   */
Trigger named handlers in Scratchpad observers.
@param string aName
Name of the handler to trigger.
@param Array aArgs
Optional array of arguments to pass to the observer(s).
@see addObserver
Trigger named handlers in Scratchpad observers . @param string aName Name of the handler to trigger . @param Array aArgs Optional array of arguments to pass to the observer ( s ) . @see addObserver
function SP_triggerObservers(aName, aArgs)
  {
    if (!aArgs) {
      aArgs = [this];
    } else {
      aArgs.unshift(this);
    }
    for (let i = 0; i < this._observers.length; ++i) {
      let observer = this._observers[i];
      let handler = observer["on" + aName];
      if (handler) {
        handler.apply(observer, aArgs);
      }
    }
  }
function SP_triggerObservers ( aName , aArgs ) { if ( ! aArgs ) { aArgs = [ this ] ; } else { aArgs . unshift ( this ) ; } for ( let i = 0 ; i < this . _observers . length ; ++ i ) { let observer = this . _observers [ i ] ; let handler = observer [ "on" + aName ] ; if ( handler ) { handler . apply ( observer , aArgs ) ; } } }
Trigger named handlers in Scratchpad observers.
Trigger named handlers in Scratchpad observers .
// insert this Scratchpad instance as the first argument // trigger all observers that implement this named handler