Bind event listener

@param {string} name of event
@param {function} callback if event is triggered
@param {object} context in which callback is called
@return {this}
487609
function(evname, callback, context) {
    this._events = this._events || {};
    var a = this._events[evname] = this._events[evname] || [];
    a.push({
      cb: callback,
      ctxt: context || this
    });
    return this;
  }
884849
public function bind($eventName, $callback, $mode = EventsHandlerInterface::BINDING_MODE_LAST)
    {
        if ($eventsHandler = $this->getEventsHandler()) {
            $eventsHandler->bind($eventName, $callback, $mode);
        }
    }
172663
public void bind(String name, T binding) {
        put(name, binding);

        Map<String, Map<String, NameClassPair>> bindingsByContext = this.contextBindings;
        if (bindingsByContext != null) {
            addContextBinding(bindingsByContext, name, binding);
        }

        Set<String> contexts = this.contexts;
        if (contexts != null) {
            contexts.add(getContextName(name));
        }
    }
1106327
function triggerEvent(eventName, _args) {
    if (typeof this[events][eventName] === 'undefined') return;
    for (let i = 0; i < this[events][eventName].length; i++) {
      try {
        this[events][eventName][i](_args);
      } catch (e) {
        console.error('Thorin.Intent: triggered event ' + eventName + ' on callback function threw an exception.');
        console.error(e);
      }
    }
    this[eventsFired][eventName] = true;
    delete this[events][eventName];
  }
600244
function Delegate(root) {

  /**
   * Maintain a map of listener
   * lists, keyed by event name.
   *
   * @type Object
   */
  this.listenerMap = [{}, {}];
  if (root) {
    this.root(root);
  }

  /** @type function() */
  this.handle = Delegate.prototype.handle.bind(this);
}
897440
function(context) {
		this._keymap = Object.create(null);
		["keydown", "keypress", "keyup"].forEach(function(type) {
			context.document.addEventListener(type, this, false);
		}, this);
	}
988733
function bind (callback, context) {
  var args = arraySlice(arguments, 2)
  context = context || this
  return function () {
    return callback.apply(context, arraySlice(arguments).concat(args))
  }
}
808326
function(events, name, callback, context, ctx) {
  if (callback) {
    var handlers = events[name] || (events[name] = []);
    handlers.push({callback: callback, context: context, ctx: context || ctx});
  }
  return events;
}
428504
function (name) {
        name = name.toLowerCase()
        if (!this._events || !this._events[name]) return this;
        var args = Array.prototype.slice.call(arguments, 1);
        var events = this._events[name];
        for (var i = 0, count = events.length; i < count; i++) {
            events[i].callback.apply(this, args);
        }
        return this;

    }
1350276
function triggerEvent(name, element) {

  var eventType;

  switch (name) {
    case "click":
    case "mousedown":
    case "mouseup":
      eventType = "MouseEvents";
    break;
    case "focus":
    case "change":
    case "blur":
    case "select":
      eventType = "HTMLEvents";
    break;
    default:
      throw new Error('Unsupported `"' + name + '"`event');
    break;
  }
  var event = document.createEvent(eventType);
  event.initEvent(name, name !== "change" , true);
  element.dispatchEvent(event, true);
}
627658
public function bind(string $name, callable $callback): self
    {
        $this->bindings[$name] = $callback;
        return $this;
    }
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]);
				}
			}
		}
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;
    };
  }
725834
function(obj, name, callback, context, listening) {
    obj._events = eventsApi(onApi, obj._events || {}, name, callback, {
      context: context,
      ctx: obj,
      listening: listening
    });

    if (listening) {
      var listeners = obj._listeners || (obj._listeners = {});
      listeners[listening.id] = listening;
    }

    return obj;
  }
472586
function registerListener(context, listener, ...arg) {
    if (context.set) {
        for (let i = 0; i < arg.length; i++) {
            if (isFunction(arg[i])) {
                listener.push(arg[i]);
            }
        }
    }
    return context;
}
279715
public function addListener($name, callable $callback) {
        if(!array_key_exists($name, $this->registered_events)) {
            $this->registered_events[$name] = [];
        }

        $this->registered_events[$name][] = $callback;
    }
1363487
def on(self, event_name, callback):
        """"""
        if not event_name:
            return False

        _LOGGER.debug("Adding callback for event name: %s", event_name)

        self._callbacks[event_name].append((callback))

        return True