Add a hook to a specific event type.

@param {String} type
@param {Function} callback
355362
function(type, callback) {
        var list = this.__hooks[type] || [];
            list.push(callback);

        this.__hooks[type] = list;
    }
435067
public function registerCallback($event, $callback)
    {
        $this->checkEventType($event);
        $this->events[$event][] = $callback;
    }
492503
function addListener(event, callback) {
    checkEventValid(event);

    if (listeners[event]) {
        listeners[event].push(callback);
    } else {
        listeners[event] = [callback];
    }
}
1273251
function(target, event, callback, traditional) {
			if(_.type(target) === 'string' || _.type(target) === 'array') {
				var elements = _.type(target) === 'string'? $$(target) : target;
				
				elements.forEach(function(element) {
					_.event.bind(element, event, callback, traditional);
				});
			}
			else if(_.type(event) === 'string') {
				if(traditional) {
					target['on' + event] = callback;
				}
				else {
					target.addEventListener(event, callback, false);
				}
			}
			else if(_.type(event) === 'array') {
				for (var i=0; i<event.length; i++) {
					_.event.bind(target, event[i], callback, arguments[2]);
				}
			}
			else {
				for (var name in event) {
					_.event.bind(target, name, event[name], arguments[2]);
				}
			}
		}
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);
        }
    }
449360
function (eventType, evt) {
    if (!this.eventListeners) {
      this.eventListeners = {};
    }
    if (!evt) {
      evt = {};
    }
    evt.type = eventType;
    if (!evt.source) {
      evt.source = this;
    }
    var events = this.eventListeners[eventType];
    if (events) {
      var len = events.length;
      for (var i = 0; i < len; i++) {
        events[i].handler.apply(this, [evt]);
      }
    }
    return this;
  }
1211316
function addListener(type, listener, context) {

		var typeName,
		    filter,
		    target,
		    entry;

		// Throw an error if no valid listener function is given
		if (typeof listener !== 'function') {
			throw TypeError('listener must be a function');
		}

		// Get the typename & filter data
		if (typeof type === 'string') {
			target = this.simpleListeners;
			typeName = type;
			entry = [listener, null, context||null];
		} else {
			target = this.filterListeners;

			if (typeof type.type === 'string') {
				typeName = type.type;
			} else {
				typeName = '';
			}

			filter = type;
			entry = [listener, filter, context||null];
		}

		// Emit the 'newListener' event
		if (this.simpleListeners.newListener || this.filterListeners.newListener) {
			this.emit('newListener', type, listener.listener ? listener.listener : listener, typeName);
		}

		if (!target[typeName]) {
			target[typeName] = [];
			this.listenTypes.push(typeName);
		}

		target[typeName].push(entry);

		return this;
	}
91582
function VKI_addListener(elem, type, func, cap) {
    if (elem.addEventListener) {
      elem.addEventListener(type, function(e) { func.call(elem, e); }, cap);
    } else if (elem.attachEvent)
      elem.attachEvent('on' + type, function() { func.call(elem); });
  }
562487
function addEventListener(type, listener, useCapture) {
      if (type === 'DOMContentLoaded') type = 'load';
      var target = this;
      var f = function(e) {
        e._timeStamp = Date.now();
        e._currentTarget = target;
        listener.call(this, e);
        e._currentTarget = null;
      };
      this['_' + type + listener] = f;
      this.attachEvent('on' + type, f);
    }
512676
function(type, callback) {
      var isSupported = false,
      root = document.documentElement,
      div = document.createElement('div'),
      handler = function() { isSupported = true; };
      root.insertBefore(div, root.firstChild);
      div.addEventListener(type, handler, true);
      if (callback && callback.call) callback(div);
      div.removeEventListener(type, handler, true);
      root.removeChild(div);
      return isSupported;
    }
1198958
function (type, handler) {

            // Validate arguments
            if (typeof type !== 'string') {
                throw new Error('Type must be a string');
            }
            if (typeof handler !== 'function') {
                throw new Error('Handler must be a function');
            }

            // Check for presence of event store
            if (!this._events) {
                this._events = {};
            }
            if (!this._events[type]) {
                this._events[type] = [];
            }

            // Add handler
            this._events[type].push(handler);

        }
398102
function( type, handler ) {

      if( handler === void 0 || handler === null )
        throw new Error( 'Missing argument "handler"' )

      if( typeof handler !== 'function' && typeof handler.handleEvent !== 'function' )
        throw new TypeError( 'Handler must be a function.' )

      function wrapper() {
        this.removeListener( type, wrapper )
        typeof handler !== 'function'
          ? handler.handleEvent.apply( handler, arguments )
          : handler.apply( this, arguments )
      }

      this._events[ type ] ?
        this._events[ type ].push( wrapper ) :
        this._events[ type ] = [ wrapper ]

      return this

    }
877661
def __add_callback(self, type_, func, serialised_if_crud=True):
        """"""
        Validation.callable_check(func)
        with self.__callbacks:
            self.__callbacks[type_].append((func, serialised_if_crud))
1233431
function Logger_addHook(callback) {
            if (!Type.isFunction(callback)) {
                throw new error.Exception('Logger hook must be function');
            }
            this.hooks.push(callback);
        }
1221
public function on($type, $callback)
    {
        if (!isset($this->callbacks[$type])) {
            $this->callbacks[$type] = [];
        }
        $this->callbacks[$type][] = $callback;
        return $this;
    }
1093038
public function addCallback($type, $callback)
    {
        if (!array_key_exists($type, $this->callbacks)) {
            throw new InvalidArgumentException(sprintf('Invalid type "%s"', $type));
        }

        $this->callbacks[$type][] = $callback;
        return $this;
    }
107734
function _attachListener(object, type, callback) {
  if (object.addEventListener) {
    object.addEventListener(type, callback, false);
  } else {
    object.attachEvent('on' + type, callback);
  }
}