Class Index | File Index

Classes


Namespace YAHOO.util.CustomEvent

YAHOO.util The CustomEvent class lets you define events for your application that can be subscribed to by one or more independent component.
Defined in: event.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
The CustomEvent class lets you define events for your application that can be subscribed to by one or more independent component.
Field Summary
Field Attributes Field Name and Description
<static>  
YAHOO.util.CustomEvent.FLAT
Subscriber listener sigature constant.
<static>  
YAHOO.util.CustomEvent.LIST
Subscriber listener sigature constant.
 
The scope the the event will fire from by default.
 
Custom events support two styles of arguments provided to the event subscribers.
 
By default all custom events are logged in the debug build, set silent to true to disable debug outpu for this event.
 
The subscribers to this event
 
The type of event, returned to subscribers when the event fires
Method Summary
Method Attributes Method Name and Description
<private>  
_delete(index)
 
fire(arguments)
Notifies the subscribers.
 
subscribe(fn, obj, override)
Subscribes the caller to this event
 
subscribeEvent(fn, obj, override)
Custom events provide a custom event that fires whenever there is a new subscriber to the event.
 
 
unsubscribe(fn, obj)
Unsubscribes the caller from this event
 
Removes all listeners
Namespace Detail
YAHOO.util.CustomEvent
The CustomEvent class lets you define events for your application that can be subscribed to by one or more independent component.
Parameters:
{String} type
The type of event, which is passed to the callback when the event fires
{Object} oScope
The context the event will fire from. "this" will refer to this object in the callback. Default value: the window object. The listener can override this.
{boolean} silent
pass true to prevent the event from writing to the debugsystem
{int} signature
the signature that the custom event subscriber will receive. YAHOO.util.CustomEvent.LIST or YAHOO.util.CustomEvent.FLAT. The default is YAHOO.util.CustomEvent.LIST.
Field Detail
<static> {int} YAHOO.util.CustomEvent.FLAT
Subscriber listener sigature constant. The FLAT type returns two parameters: the first argument passed to fire and the optional custom object

<static> {int} YAHOO.util.CustomEvent.LIST
Subscriber listener sigature constant. The LIST type returns three parameters: the event type, the array of args passed to fire, and the optional custom object

{object} scope
The scope the the event will fire from by default. Defaults to the window obj

{int} signature
Custom events support two styles of arguments provided to the event subscribers.

{boolean} silent
By default all custom events are logged in the debug build, set silent to true to disable debug outpu for this event.

{Subscriber[]} subscribers
The subscribers to this event

{string} type
The type of event, returned to subscribers when the event fires
Method Detail
<private> _delete(index)
Parameters:
index

{boolean} fire(arguments)
Notifies the subscribers. The callback functions will be executed from the scope specified when the event was created, and with the following parameters:
Parameters:
{Object*} arguments
an arbitrary set of parameters to pass to the handler.
Returns:
{boolean} false if one of the subscribers returned false, true otherwise

subscribe(fn, obj, override)
Subscribes the caller to this event
Parameters:
{Function} fn
The function to execute
{Object} obj
An object to be passed along when the event fires
{boolean|Object} override
If true, the obj passed in becomes the execution scope of the listener. if an object, that object becomes the the execution scope.

{YAHOO.util.CustomEvent} subscribeEvent(fn, obj, override)
Custom events provide a custom event that fires whenever there is a new subscriber to the event. This provides an opportunity to handle the case where there is a non-repeating event that has already fired has a new subscriber.
Parameters:
{Function} fn
The function to execute
{Object} obj
An object to be passed along when the event fires
{boolean|Object} override
If true, the obj passed in becomes the execution scope of the listener. if an object, that object becomes the the execution scope.

toString()

{boolean} unsubscribe(fn, obj)
Unsubscribes the caller from this event
Parameters:
{Function} fn
The function to execute
{Object} obj
The custom object passed to subscribe (optional)
Returns:
{boolean} True if the subscriber was found and detached.

unsubscribeAll()
Removes all listeners

Documentation generated by JsDoc Toolkit 2.0.0 on Thu Dec 02 2010 15:18:58 GMT+0100 (CET)