Class YAHOO.util.CustomEvent

Object
   |
   +--YAHOO.util.CustomEvent

class YAHOO.util.CustomEvent

Field Summary [top]

object scope
The scope the the event will fire from by default. 
Subscriber[] subscribers
The subscribers to this event 
string type
The type of event, returned to subscribers when the event fires 

Constructor Summary [top]

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

Method Summary [top]

void fire ()
Notifies the subscribers. 
void subscribe (<Function> fn, <Object> obj, <boolean> bOverride)
Subscribes the caller to this event 
boolean unsubscribe (<Function> fn, <Object> obj)
Unsubscribes the caller from this event 
void unsubscribeAll ()
Removes all listeners 

Field Detail [top]

scope

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

subscribers

Subscriber[]   subscribers
The subscribers to this event

type

string   type
The type of event, returned to subscribers when the event fires

Constructor Detail [top]

YAHOO.util.CustomEvent

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:
type - The type of event, which is passed to the callback when the event fires
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.

Method Detail [top]

fire

void fire ()
Notifies the subscribers. The callback functions will be executed from the scope specified when the event was created, and with the following parameters:
   - The type of event
   - All of the arguments fire() was executed with as an array
   - The custom object (if any) that was passed into the subscribe() method
   
Parameters:
an - arbitrary set of parameters to pass to the handler

subscribe

void subscribe (<Function> fn, <Object> obj, <boolean> bOverride)
Subscribes the caller to this event
Parameters:
fn - The function to execute
obj - An object to be passed along when the event fires
bOverride - If true, the obj passed in becomes the execution scope of the listener

unsubscribe

boolean unsubscribe (<Function> fn, <Object> obj)
Unsubscribes the caller from this event
Parameters:
fn - The function to execute
obj - An object to be passed along when the event fires
Returns:
True if the subscriber was found and detached.

unsubscribeAll

void unsubscribeAll ()
Removes all listeners