Class YAHOO.util.EventProvider
Package: | YAHOO.util |
Class: | EventProvider |
Extends: | Object |
Defined In: | event.js |
EventProvider is designed to be used with YAHOO.augment to wrap
CustomEvents in an interface that allows events to be subscribed to
and fired by name. This makes it possible for implementing code to
subscribe to an event that either has not been created yet, or will
not be created at all.
Public Properties
This class has no public properties.
Public Methods
|
createEvent(p_type {string} , p_config {object} ) : CustomEvent |
EventProvider |
Creates a new custom event of the specified type. If a custom event
by that name already exists, it will not be re-c... |
|
fireEvent(p_type {string} , arguments {Object*} ) : boolean |
EventProvider |
Fire a custom event by name. The callback functions will be executed
from the scope specified when the event was cre... |
|
hasEvent(type {string} ) : void |
EventProvider |
Returns true if the custom event of the provided type has been created
with createEvent. |
|
subscribe(p_type {string} , p_fn {function} , p_obj , p_obj {Object} , p_override {boolean} ) : void |
EventProvider |
Subscribe to a CustomEvent by event type |
|
unsubscribe(p_type {string} , p_fn {Function} , [p_obj {Object} ]) : boolean |
EventProvider |
Unsubscribes the from the specified event |
Public Events
This class has no public events.
Method Details
createEvent
public function createEvent(p_type {string}
, p_config {object}
)
Creates a new custom event of the specified type. If a custom event
by that name already exists, it will not be re-created. In either
case the custom event is returned.
Parameters:
Returns:
CustomEvent
the custom event
This method is defined by EventProvider.
fireEvent
public function fireEvent(p_type {string}
, arguments {Object*}
)
Fire a custom event by name. The callback functions will be executed
from the scope specified when the event was created, and with the
following parameters:
- The first argument fire() was executed with
- The custom object (if any) that was passed into the subscribe()
method
This method is defined by EventProvider.
hasEvent
public function hasEvent(type {string}
)
Returns true if the custom event of the provided type has been created
with createEvent.
This method is defined by EventProvider.
subscribe
public function subscribe(p_type {string}
, p_fn {function}
, p_obj
, p_obj {Object}
, p_override {boolean}
)
Subscribe to a CustomEvent by event type
Parameters:
{string}
: p_typethe type, or name of the event
{function}
: p_fnthe function to exectute when the event fires
: p_obj{Object}
: p_objAn object to be passed along when the event fires
{boolean}
: p_overrideIf true, the obj passed in becomes the execution scope of the listener
Returns:
This method is defined by EventProvider.
unsubscribe
public function unsubscribe(p_type {string}
, p_fn {Function}
, [p_obj {Object}
])
Unsubscribes the from the specified event
This method is defined by EventProvider.
yui-ext - Copyright © 2006 Jack Slocum. |
Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.