Adds the EventDispatcher APIs to the given object: on(), one(), off(), and trigger(). May also be
called on a prototype object - each instance will still behave independently.
@param {!Object} obj Object to add event-dispatch methods to
436873
function makeEventDispatcher(obj) {
        $.extend(obj, {
            on: on,
            off: off,
            one: one,
            trigger: trigger,
            _EventDispatcher: true
        });
        // Later, on() may add _eventHandlers: Object.<string, Array.<{event:string, namespace:?string,
        //   handler:!function(!{type:string, target:!Object}, ...)}>> - map from eventName to an array
        //   of handler records
        // Later, markDeprecated() may add _deprecatedEvents: Object.<string, string|boolean> - map from
        //   eventName to deprecation warning info
    }
45961
function() {
    var self = this;
    Pusher.EventsDispatcher.call(this);
    // This is okay, as IE doesn't support this stuff anyway.
    if (window.addEventListener !== undefined) {
      window.addEventListener("online", function() {
        self.emit('online', null);
      }, false);
      window.addEventListener("offline", function() {
        self.emit('offline', null);
      }, false);
    }
  }
471781
function(object, events, callback) {
      var listeners = this._listeners;
      if (!listeners) return;
      if (object) {
        object.off(events, callback, this);
        if (!events && !callback) delete listeners[object._listenerId];
      } else {
        for (var id in listeners) {
          listeners[id].off(null, null, this);
        }
        this._listeners = {};
      }
      return this;
    }
208448
function (obj, type, func) {
    if (!obj || !type || !func) return false;
    obj.funcCache = obj.funcCache || {};
    obj.funcCache[type] = func;
    if (obj.addEventListener) obj.addEventListener(type, func, false);
    else obj.attachEvent("on" + type, func);
  }
1343022
function(view, event_name, event_object, targets) {

		this._dispatchCallback(
			view,
			targets,
			this._callHandleEvent,
			{
				event_name: event_name,
				event_object: event_object
			},
			this._global_event_targets
		);

	}
155716
function addEvent(obj, evt, func){
    var a;

    // Sensible browsers use `addEventListener`
    if((a = obj.addEventListener)){
      a.call(obj, evt, func, false);

    // IE uses `attachEvent`
    }else{
      obj.attachEvent('on' + evt, func);
    }
  }
594850
function(items, enabled)
	{
		var method = enabled === false ? 'removeEventListener' : 'addEventListener';
		
		items = (conbo.isArray(items) ? items : [items]).slice();
		
		while (items.length)
		{
			var item = items.pop();
			
			if (item instanceof conbo.EventDispatcher)
			{
				item[method](conbo.ConboEvent.CHANGE, this.dispatchEvent, this);
			}
		}
	}
513118
@Override
  public void add(Object obj) {
    lock.writeLock().lock();
    try {
      populated = true;
      this.queueActionLocked(DeltaType.Added, obj);
    } finally {
      lock.writeLock().unlock();
    }
  }
377004
function pluginTarget(obj)
{
    obj.__plugins = {};

    /**
     * Adds a plugin to an object
     *
     * @param pluginName {string} The events that should be listed.
     * @param ctor {Object} ?? @alvin
     */
    obj.registerPlugin = function (pluginName, ctor)
    {
        obj.__plugins[pluginName] = ctor;
    };

    /**
     * Instantiates all the plugins of this object
     *
     */
    obj.prototype.initPlugins = function ()
    {
        this.plugins = this.plugins || {};

        for (var o in obj.__plugins)
        {
            this.plugins[o] = new (obj.__plugins[o])(this);
        }
    };

    /**
     * Removes all the plugins of this object
     *
     */
    obj.prototype.destroyPlugins = function ()
    {
        for (var o in this.plugins)
        {
            this.plugins[o].destroy();
            this.plugins[o] = null;
        }

        this.plugins = null;
    };
}
206114
function (events, context) {
    if (!_.isObject(events)) {
      console.warn('Only registration objects can be passed to dispatcher.register()');
      return;
    }

    return this.dispatcher.register(function (payload) {
      // Switch statements be damned...
      if (events[payload.type]) {
        events[payload.type].apply(context || null, [payload.data]);
      }
    });
  }
790458
function (object, event, callback) {
        var index = this.indexOf(object);
        var listener = this.listeners[index];
        if (!listener) {
            listener = {
                'object': object,
                'events': {}
            };
            this.listeners.push(listener);
        }

        var callbacks = listener.events[event];
        if (!callbacks) {
            callbacks = [];
            listener.events[event] = callbacks;
        }

        // add the callback if it does not yet exist
        if (callbacks.indexOf(callback) == -1) {
            callbacks.push(callback);
        }
    }
429908
function () {
    // Allow using a function or an object
    var events = _.result(this, 'dispatcherEvents');

    if (_.isUndefined(events) || _.isEmpty(events)) {
      // Bug out early if no dispatcherEvents
      return;
    }

    var registrations = {};
    _.each(events, function (funcOrName, actionType) {
      // Quick sanity check for whether there is a problem with the function/name passed
      if (!(_.isFunction(funcOrName) || _.isFunction(this[funcOrName]))) {
        console.warn('dispatcherEvent: "' + funcOrName + '" is not a function');
        return;
      }

      if (_.isFunction(funcOrName)) {
        registrations[actionType] = funcOrName;
      } else {
        registrations[actionType] = this[funcOrName];
      }

    }.bind(this));

    this.dispatcherToken = dispatcher.register(registrations, this);
  }
753665
function attachEvent(obj, type, func, scope)
    {
        function handler(e)
        {
            e = e || window.event;

            if (!e.target)
            {
                e.target = e.srcElement;
                e.preventDefault = function()
                {
                    this.returnValue = false;
                };
            }

            func.call(scope || window, e);
        };

        if (obj.attachEvent)
        {
            obj.attachEvent('on' + type, handler);
        }
        else
        {
            obj.addEventListener(type, handler, false);
        }
    }
169977
function(obj, name, callback) {
      var listeners = this._listeners;
      if (!listeners) return this;
      var deleteListener = !name && !callback;
      if (typeof name === 'object') callback = this;
      if (obj) (listeners = {})[obj._listenerId] = obj;
      for (var id in listeners) {
        listeners[id].off(name, callback, this);
        if (deleteListener) delete this._listeners[id];
      }
      return this;
    }
1099845
function Events (el, obj) {
  if (!(this instanceof Events)) return new Events(el, obj)
  if (!el) throw new Error('element required')
  if (!obj) throw new Error('object required')
  this.el = el
  this.obj = obj
  this._events = {}
}
984125
function byNameDispatcher(keysArray, objectWithDispatchMethods) {
  return function handleOrRecurse(singleSignalK) {
    if (typeof singleSignalK === 'object' && singleSignalKx !== null) {
    var branchName = Object.keys(singleSignalK)[0];
    if (keysArray.indexOf(branchName) != -1) {
      var dispatcherFunction = objectWithDispatchMethods['handle_' + branchName];
      if (typeof dispatcherFunction === 'function') {
        dispatcherFunction.bind(objectWithDispatchMethods);
        dispatcherFunction.call(objectWithDispatchMethods, singleSignalK[branchName].value);
      } else {
        console.error("No method named handle_" + branchName + " found");
        console.error(JSON.stringify(objectWithDispatchMethods));
      }
    } else {
      handleOrRecurse(singleSignalK[branchName]);
    }
  }
  }
}
1336410
function ( obj, event ) {
		var quit = false,
		    a    = array.remove( array.cast( arguments ), 0, 1 ),
		    o, s, log, list;

		if ( observer.ignore ) {
			return obj;
		}

		o = observer.id( obj );

		if ( o === undefined || event === undefined ) {
			throw new Error( label.error.invalidArguments );
		}

		if ( observer.silent ) {
			observer.queue.push( {obj: obj, event: event} );
		}
		else {
			s   = state.getCurrent();
			log = $.logging;

			array.each( string.explode( event ), function ( e ) {
				if ( log ) {
					utility.log(o + " firing " + e );
				}

				list = observer.list( obj, e, observer.alisteners );

				if ( list.all !== undefined ) {
					array.each( list.all, function ( i ) {
						var result = i.fn.apply( i.scope, a );

						if ( result === false ) {
							quit = true;

							return result;
						}
					});
				}

				if ( !quit && s !== "all" && list[s] !== undefined ) {
					array.each( list[s], function ( i ) {
						return i.fn.apply( i.scope, a );
					});
				}
			});
		}

		return obj;
	}