Class YAHOO.ext.EventManager
| Package: | YAHOO.ext |
| Class: | EventManager |
| Extends: | Object |
| Defined In: | EventManager.js |
Registers event handlers that want to receive a normalized EventObject instead of the standard browser event and provides
several useful events directly.
See
YAHOO.ext.EventObject for more details on normalized event objects.
This class is a singleton and cannot be created directly.
Public Properties
This class has no public properties.
Public Methods
| |
addListener(Object element, String eventName, Function fn, Object scope, boolean override) : Function |
EventManager |
| Appends an event handler |
| |
on(Object element, String eventName, Function fn, Object scope, boolean override) : Function |
EventManager |
| Appends an event handler (shorthand for addListener) |
| |
onDocumentReady(Function fn, Object scope, boolean override) : void |
EventManager |
| Fires when the document is ready (before onload and before images are loaded) |
| |
onWindowResize(Function fn, Object scope, boolean override) : void |
EventManager |
| Fires when the window is resized and provides resize event buffering (50 milliseconds), passes new viewport width and... |
| |
removeListener(Object element, String eventName, Function wrappedFn) : Boolean |
EventManager |
| Removes an event handler |
| |
removeResizeListener(Function fn, Object scope) : void |
EventManager |
| Removes the passed window resize listener. |
| |
wrap(Function fn, Object scope, boolean override) : Function |
EventManager |
| Places a simple wrapper around an event handler to override the browser event
object with a YAHOO.ext.EventObject |
Public Events
This class has no public events.
Method Details
addListener
public function addListener(Object element, String eventName, Function fn, Object scope, boolean override)
Appends an event handler
Parameters:
element : ObjectThe html element to assign the event to
eventName : StringThe type of event to append
fn : FunctionThe method the event invokes
scope : ObjectAn object that becomes the scope of the handler
override : booleanIf true, the obj passed in becomes the execution scope of the listener
Returns:
This method is defined by EventManager.
on
public function on(Object element, String eventName, Function fn, Object scope, boolean override)
Appends an event handler (shorthand for addListener)
Parameters:
element : ObjectThe html element to assign the event to
eventName : StringThe type of event to append
fn : FunctionThe method the event invokes
scope : ObjectAn arbitrary object that will be passed as a parameter to the handler
override : booleanIf true, the obj passed in becomes the execution scope of the listener
Returns:
This method is defined by EventManager.
onDocumentReady
public function onDocumentReady(Function fn, Object scope, boolean override)
Fires when the document is ready (before onload and before images are loaded)
Parameters:
fn : FunctionThe method the event invokes
scope : ObjectAn object that becomes the scope of the handler
override : booleanIf true, the obj passed in becomes the execution scope of the listener
Returns:
This method is defined by EventManager.
onWindowResize
public function onWindowResize(Function fn, Object scope, boolean override)
Fires when the window is resized and provides resize event buffering (50 milliseconds), passes new viewport width and height to handlers.
Parameters:
fn : FunctionThe method the event invokes
scope : ObjectAn object that becomes the scope of the handler
override : booleanIf true, the obj passed in becomes the execution scope of the listener
Returns:
This method is defined by EventManager.
removeListener
public function removeListener(Object element, String eventName, Function wrappedFn)
Removes an event handler
Parameters:
element : ObjectThe html element to remove the event from
eventName : StringThe type of event to append
wrappedFn : FunctionThe wrapper method returned when adding the listener
Returns:
This method is defined by EventManager.
removeResizeListener
public function removeResizeListener(Function fn, Object scope)
Removes the passed window resize listener.
This method is defined by EventManager.
wrap
public function wrap(Function fn, Object scope, boolean override)
Places a simple wrapper around an event handler to override the browser event
object with a YAHOO.ext.EventObject
Parameters:
fn : FunctionThe method the event invokes
scope : ObjectAn object that becomes the scope of the handler
override : booleanIf true, the obj passed in becomes the execution scope of the listener
Returns:
FunctionThe wrapped function
This method is defined by EventManager.