events.js
- Source
Members
(inner) _supportsPassive
Whether passive event listeners are supported
- Source
(inner, constant) passiveEvents
Touch events Chrome expects to be passive
- Source
Methods
(static) any(elem, type, fn)
Trigger a listener only once and then turn if off for all configured events
| Name | Type | Description | 
|---|---|---|
| elem | Element | | Element or object to bind to. | 
| type | string | | Name/type of event | 
| fn | Event~EventListener | Event listener function | 
- Source
(static) fixEvent(event) → {Object}
Fix a native event to have standard property values
| Name | Type | Description | 
|---|---|---|
| event | Object | Event object to fix. | 
- Source
Fixed event object.
- Type:
- Object
(static) off(elem, typeopt, fnopt)
Removes event listeners from an element
| Name | Type | Attributes | Description | 
|---|---|---|---|
| elem | Element | | Object to remove listeners from. | |
| type | string | | <optional> | Type of listener to remove. Don't include to remove all events from element. | 
| fn | function | <optional> | Specific listener to remove. Don't include to remove listeners for an event type. | 
- Source
(static) on(elem, type, fn)
Add an event listener to element It stores the handler function in a separate cache object and adds a generic handler to the element's event, along with a unique id (guid) to the element.
| Name | Type | Description | 
|---|---|---|
| elem | Element | | Element or object to bind listeners to | 
| type | string | | Type of event to bind to. | 
| fn | function | Event listener. | 
- Source
(static) one(elem, type, fn)
Trigger a listener only once for an event.
| Name | Type | Description | 
|---|---|---|
| elem | Element | | Element or object to bind to. | 
| type | string | | Name/type of event | 
| fn | Event~EventListener | Event listener function | 
- Source
(static) trigger(elem, event, hashopt) → {boolean|undefined}
Trigger an event for an element
| Name | Type | Attributes | Description | 
|---|---|---|---|
| elem | Element | | Element to trigger an event on | |
| event | EventTarget~Event | | A string (the type) or an event object with a type attribute | |
| hash | Object | <optional> | data hash to pass along with the event | 
- Source
Returns the opposite of defaultPrevented if default was prevented. Otherwise, returns undefined
- Type:
- boolean |undefined 
(inner) _cleanUpEvents(elem, type)
Clean up the listener cache and dispatchers
| Name | Type | Description | 
|---|---|---|
| elem | Element | | Element to clean up | 
| type | string | Type of event to clean up | 
- Source
(inner) _handleMultipleEvents(fn, elem, types, callback)
Loops through an array of event types and calls the requested method for each type.
| Name | Type | Description | 
|---|---|---|
| fn | function | The event method we want to use. | 
| elem | Element | | Element or object to bind listeners to | 
| types | Array.<string> | Type of event to bind to. | 
| callback | function | Event listener. | 
- Source