events.js. An Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/) (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible) This should work very similarly to jQuery's events, however it's based off the book version which isn't as robust as jquery's, so there's probably some differences.
Members
- 
inner _supportsPassive
- 
    
    Whether passive event listeners are supported 
- 
inner, constant passiveEvents
- 
    
    Touch events Chrome expects to be passive 
Methods
- 
    
        static fixEvent(event) → {Object}
- 
    
    Fix a native event to have standard property values Parameters:Name Type Description eventObject Event object to fix. Returns:Object -Fixed event object. 
- 
    
        static off(elem, typeopt, fnopt)
- 
    
    Removes event listeners from an element Parameters:Name Type Attributes Description elemElement | Object Object to remove listeners from. typestring | Array.<string> <optional> 
 Type of listener to remove. Don't include to remove all events from element. fnEventTarget~EventListener <optional> 
 Specific listener to remove. Don't include to remove listeners for an event type. 
- 
    
        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. Parameters:Name Type Description elemElement | Object Element or object to bind listeners to typestring | Array.<string> Type of event to bind to. fnEventTarget~EventListener Event listener. 
- 
    
        static one(elem, type, fn)
- 
    
    Trigger a listener only once for an event Parameters:Name Type Description elemElement | Object Element or object to bind to. typestring | Array.<string> Name/type of event fnEvent~EventListener Event Listener function 
- 
    
        static trigger(elem, event, hashopt) → {boolean|undefined}
- 
    
    Trigger an event for an element Parameters:Name Type Attributes Description elemElement | Object Element to trigger an event on eventEventTarget~Event | string A string (the type) or an event object with a type attribute hashObject <optional> 
 data hash to pass along with the event Returns:boolean | undefined -- Returns the opposite of defaultPreventedif default was prevented- Otherwise returns undefined
 
- Returns the opposite of 
- 
    
        inner _cleanUpEvents(elem, type)
- 
    
    Clean up the listener cache and dispatchers Parameters:Name Type Description elemElement | Object Element to clean up typestring Type of event to clean up 
- 
    
        inner _handleMultipleEvents(fn, elem, type, callback)
- 
    
    Loops through an array of event types and calls the requested method for each type. Parameters:Name Type Description fnfunction The event method we want to use. elemElement | Object Element or object to bind listeners to typestring Type of event to bind to. callbackEventTarget~EventListener Event listener.