Ext.EventManager
Files
Registers event handlers that want to receive a normalized EventObject instead of the standard browser event and provides several useful events directly. See Ext.EventObject for more details on normalized event objects.
Available since: 1.1.0
Properties
Keep track of the current width/height
Defaults to: 0
Available since: 4.0.0
Check if we have bound our global onReady listener
Defaults to: false
Available since: 4.0.0
Check if fireDocReady has been called
Defaults to: false
Available since: 4.0.0
Checks if we have bound an onreadystatechange event
Defaults to: false
Available since: 4.0.0
--------------------- utility methods ---------------------
Defaults to: /(mouseout|mouseleave)/
Available since: 4.0.0
Options to parse for the 4th argument to addListener.
Defaults to: /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate|freezeEvent)$/
Available since: 4.0.0
Holds references to any onReady functions
Holds references to any onReady functions
Available since: 4.0.0
Timer for the document ready event in old IE versions
Timer for the document ready event in old IE versions
Available since: 4.0.0
Contains a list of all document mouse downs, so we can ensure they fire even when stopEvent is called.
Contains a list of all document mouse downs, so we can ensure they fire even when stopEvent is called.
Available since: 4.0.0
note 1: IE fires ONLY the keydown event on specialkey autorepeat note 2: Safari < 3.1, Gecko (Mac/Linux) & Opera fire only the keypress event on specialkey autorepeat (research done by Jan Wolter at http://unixpapa.com/js/key.html)
Available since: 4.0.0
Methods
Appends an event handler to an element. The shorthand version on is equivalent. Typically you will use Ext.Element.addListener directly on an Element in favor of calling this version.
Available since: 1.1.0
Parameters
- el : String/HTMLElement
The html element or id to assign the event handler to.
- eventName : String
The name of the event to listen for.
- handler : Function
The handler function the event invokes. This function is passed the following parameters:
- evt : EventObjectThe EventObject describing the event.
- t : ElementThe Element which was the target of the event. Note that this may be filtered by using the delegate option.
- o : ObjectThe options object from the addListener call.
- evt : EventObject
- scope : Object (optional)
The scope (
thisreference) in which the handler function is executed. Defaults to the Element. - options : Object (optional)
An object containing handler configuration properties. This may contain any of the following properties:
- scope : ObjectThe scope (
thisreference) in which the handler function is executed. Defaults to the Element. - delegate : StringA simple selector to filter the target or look for a descendant of the target
- stopEvent : BooleanTrue to stop the event. That is stop propagation, and prevent the default action.
- preventDefault : BooleanTrue to prevent the default action
- stopPropagation : BooleanTrue to prevent event propagation
- normalized : BooleanFalse to pass a browser event to the handler function instead of an Ext.EventObject
- delay : NumberThe number of milliseconds to delay the invocation of the handler after te event fires.
- single : BooleanTrue to add a handler to handle just the next firing of the event, and then remove itself.
- buffer : NumberCauses the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.
- target : ElementOnly call the handler if the event was fired on the target Element, not if the event was bubbled up from a child node.
See Ext.Element.addListener for examples of how to use these options.
- scope : Object
Binds the appropriate browser event for checking if the DOM has loaded.
Available since: 4.0.0
Check the ready state for old IE versions
Available since: 3.4.0
Returns
- Boolean
True if the document is ready
Checks whether the event's relatedTarget is contained inside (or is) the element.
Available since: 4.0.0
Parameters
- event : Object
We know the document is loaded, so trigger any onReady events.
Available since: 4.0.0
Fires the unload event for items bound with onWindowUnload
Available since: 4.0.0
Gets the event cache for the object
Available since: 4.0.0
Parameters
- element : HTMLElement
The element
Returns
- Object
The event cache for the object
Get the id of the element. If one has not been assigned, automatically assign it.
Available since: 4.0.0
Parameters
- element : HTMLElement/Ext.Element
The element to get the id for.
Returns
- String
id
Indicates which event to use for getting key presses.
Available since: 4.0.0
Returns
- String
The appropriate event name.
Gets the related target from the event.
Available since: 4.0.0
Parameters
- event : Object
The event
Returns
- HTMLElement
The related target.
Gets the target of the event.
Available since: 4.0.0
Parameters
- event : Object
The event
Returns
- HTMLElement
target
Alias for Ext.EventManager.addListener
Available since: 1.1.0
Adds a listener to be notified when the document is ready (before onload and before images are loaded). Can be accessed shorthanded as Ext.onReady().
Available since: 1.1.0
Parameters
- fn : Function
The method the event invokes.
- scope : Object (optional)
The scope (
thisreference) in which the handler function executes. Defaults to the browser window. - options : Boolean (optional)
Options object as passed to Ext.Element.addListener.
Adds a listener to be notified when the browser window is resized and provides resize event buffering (100 milliseconds), passes new viewport width and height to handlers.
Available since: 1.1.0
Parameters
- fn : Function
The handler function the window resize event invokes.
- scope : Object
The scope (
thisreference) in which the handler function executes. Defaults to the browser window. - options : Boolean
Options object as passed to Ext.Element.addListener
Convert a "config style" listener into a set of flat arguments so they can be passed to addListener
Available since: 4.0.0
Parameters
Prevents the browsers default handling of the event.
Available since: 4.0.0
Parameters
- The : Event
event to prevent the default
Recursively removes all previous added listeners from an element and its children. Typically you will use Ext.Element.purgeAllListeners directly on an Element in favor of calling this version.
Available since: 4.0.0
Parameters
Removes all event handers from an element. Typically you will use Ext.Element.removeAllListeners directly on an Element in favor of calling this version.
Available since: 2.3.0
Parameters
- el : String/HTMLElement
The id or html element from which to remove all event handlers.
Removes an event handler from an element. The shorthand version un is equivalent. Typically you will use Ext.Element.removeListener directly on an Element in favor of calling this version.
Available since: 1.1.0
Parameters
- el : String/HTMLElement
The id or html element from which to remove the listener.
- eventName : String
The name of the event.
- fn : Function
The handler function to remove. This must be a reference to the function passed into the addListener call.
- scope : Object
If a scope (
thisreference) was specified when the listener was added, then this must refer to the same object.
Resolve any text nodes accounting for browser differences.
Available since: 4.0.0
Parameters
- node : HTMLElement
The node
Returns
- HTMLElement
The resolved node
Stop the event (preventDefault and stopPropagation)
Available since: 4.0.0
Parameters
- The : Event
event to stop
Cancels bubbling of the event.
Available since: 4.0.0
Parameters
- The : Event
event to stop bubbling.
Alias for Ext.EventManager.removeListener
Available since: 1.1.0