B2G/gecko/browser/components/tabview/modules/utils.jsm
// The given callback will be called when the Subscribable fires the given event.
The given callback will be called when the Subscribable fires the given event.
The given callback will be called when the Subscribable fires the given event .
function Subscribable_addSubscriber(eventName, callback) {
    try {
      Utils.assertThrow(typeof callback == "function", "callback must be a function");
      Utils.assertThrow(eventName && typeof eventName == "string",
          "eventName must be a non-empty string");
    } catch(e) {
      Utils.log(e);
      return;
    }
    if (!this.subscribers)
      this.subscribers = {};
    if (!this.subscribers[eventName])
      this.subscribers[eventName] = [];
    let subscribers = this.subscribers[eventName];
    if (subscribers.indexOf(callback) == -1)
      subscribers.push(callback);
  }
function Subscribable_addSubscriber ( eventName , callback ) { try { Utils . assertThrow ( typeof callback == "function" , "callback must be a function" ) ; Utils . assertThrow ( eventName && typeof eventName == "string" , "eventName must be a non-empty string" ) ; } catch ( e ) { Utils . log ( e ) ; return ; } if ( ! this . subscribers ) this . subscribers = { } ; if ( ! this . subscribers [ eventName ] ) this . subscribers [ eventName ] = [ ] ; let subscribers = this . subscribers [ eventName ] ; if ( subscribers . indexOf ( callback ) == - 1 ) subscribers . push ( callback ) ; }
The given callback will be called when the Subscribable fires the given event.
The given callback will be called when the Subscribable fires the given event .