Adds an event listener.

@param {String} events space separated list of events to listen on
@param {Function} callback
@param {Mixed} context
@api public
355907
function on(event, callback, context) {
        var events = eventsplitter.test(event)
            ? event.split(eventsplitter)
            : [event];

        this.events = this.events || (this.events = {});

        while (event = events.shift()) {
          if (!event) continue;

          (this.events[event] = this.events[event] || []).push({
              context: context
            , callback: callback
          });
        }

        return this;
      }
219917
def add_listener(event, &block)
      fail ArgumentError, 'must provide callback' unless block_given?
      listeners(event.to_sym).push block
    end
238895
function listenersHelp (element, events, handler, method) {
  let list = events.split(' ')
  for (let i = 0, len = list.length; i < len; i++) {
    let item = list[i]
    if (method === false) {
      element.removeEventListener(item, handler)
    } else {
      element.addEventListener(item, handler, false)
    }
  }
}
695994
function (element, events, func) {
            for (var i = 0; i < events.length; i++) {
                element.addEventListener(events[i], func);
            }
        }
225805
function (name, fn, ctx) {
        assert(isString(name), 'EventEmitter#on: name is not a string');
        assert(isFunction(fn), 'EventEmitter#on: fn is not a function');

        // If the context is not passed, use `this`.
        ctx = ctx || this;

        // Push to private lists of listeners.
        this._listeners.push({
            name: name,
            fn: fn,
            ctx: ctx
        });

        return this;
    }
157004
function _addEventListener(eventName, xhr){
  xhr.addEventListener(eventName, function (event) {
    var listener = xhr["on" + eventName];

    if (listener && typeof listener == "function") {
      listener.call(event.target, event);
    }
  });
}
796691
function getEvent(context, eventName) {
  if (!eventsMap.has(context)) {
    eventsMap.set(context, {});
  }
  const events = eventsMap.get(context);
  if (!events[eventName]) {
    events[eventName] = {
      listeners: [],
      meta: new WeakMap()
    };
  }
  return events[eventName];
}
443191
function addListener(eventType, fn){
  if (document.addEventListener) {
    document.addEventListener(eventType, fn, false);
  } else {
    document.attachEvent("on" + eventType, fn);
  }
}
760223
function appendListener(event, listener, once) {

    this.events[event] = this.events[event] || [];
    this.events[event].push({
      "listener": listener,
      "once": !!once
    });

    this.emit('newListener', event, listener);

    if (this.events[event].length > this.maxListeners) {

      console.warn('warning: possible EventEmitter memory leak detected. ',
        this.events[event].length, ' listeners added. ',
        'Use emitter.setMaxListeners() to increase limit. ',
        this);

    }

  }
781917
function on(emitter, eventName, handler, context) {
  handler = context ? handler.bind(context) : handler;
  emitter.addEventListener(eventName, handler);
  return handler;
}
482449
function(object, events, callback) {
      var listeners = this._listeners || (this._listeners = {});
      var id = object._listenerId || (object._listenerId = _.uniqueId('l'));
      listeners[id] = object;
      object.on(events, callback || this, this);
      return this;
    }
1197592
function(name, callback, context) {
      if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this;
      var self = this;
      var once = _.once(function() {
        self.off(name, once);
        callback.apply(this, arguments);
      });
      once._callback = callback;
      return this.on(name, once, context);
    }
175782
function onListeners($this, eventsInput, callback, context, type)
  {
    if ( !isFunction( callback ) )
    {
      return noop;
    }

    var callbackContext = context || $this;
    var events = toArray( eventsInput, ' ' );
    var listeners = $this.$$on;

    if ( !listeners )
    {
      Class.prop( $this, '$$on', listeners = {} );
    }

    var nodes = [];

    for (var i = 0; i < events.length; i++)
    {
      var eventName = events[ i ];
      var eventListeners = listeners[ eventName ];

      if ( !eventListeners )
      {
        eventListeners = listeners[ eventName ] = new EventNode();
      }

      nodes.push( new EventNode( eventListeners, callback, callbackContext, type, triggerId ) );
    }

    return function ignore()
    {
      for (var i = 0; i < nodes.length; i++)
      {
        nodes[ i ].remove();
      }

      nodes.length = 0;
    };
  }
11906
function addEvent(el, e, callback, capture) {
    if (el.addEventListener) {
      el.addEventListener(e, callback, capture || false);
    }
    else
      if (el.attachEvent) {
        el.attachEvent('on' + e, callback);
      }
  }
1164086
function (name, callback) {
        name = name.toLowerCase()
        this._events || (this._events = {})
        var events = this._events[name] || (this._events[name] = [])
        events.push({
            callback: callback
        })
        return this;
    }
897440
function(context) {
		this._keymap = Object.create(null);
		["keydown", "keypress", "keyup"].forEach(function(type) {
			context.document.addEventListener(type, this, false);
		}, this);
	}
1168413
public function listen($event, $callback)
    {
        if (!isset($this->listeners[$event])) {
            $this->listeners[$event] = [];
        }

        $this->listeners[$event][] = $callback;
    }