constructor new Event.Handler

View source on GitHub →

new Event.Handler(element, eventName[, selector], callback)
  • element (Element) – The element to listen on.
  • eventName (String) – An event to listen for. Can be a standard browser event or a custom event.
  • selector (String) – A CSS selector. If specified, will call callback only when it can find an element that matches selector somewhere in the ancestor chain between the event's target element and the given element.
  • callback (Function) – The event handler function. Should expect two arguments: the event object and the element that received the event. (If selector was given, this element will be the one that satisfies the criteria described just above; if not, it will be the one specified in the element argument).

Instantiates an Event.Handler. Will not begin observing until Event.Handler#start is called.