[ árbol de herencia ] [ índice general ]

YAHOO.util.CustomEvent



CustomEvent
Object
   |
   +--YAHOO.util.CustomEvent

Ubicada en yahoo.js

Métodos
boolean fire() Notifies the subscribers.
void subscribe(<Function> fn, <Object> obj, <boolean|Object> overrideContext) Subscribes the caller to this event
Object toString()
boolean unsubscribe(<Function> fn, <Object> obj) Unsubscribes subscribers.
int unsubscribeAll() Removes all listeners

YAHOO.util.CustomEvent

  YAHOO.util.CustomEvent (<String> type, <Object> context, <boolean> silent, <int> signature)

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

Parámetros:
type   The type of event, which is passed to the callback when the event fires
context   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.
silent   pass true to prevent the event from writing to the debugsystem
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.
fire

  boolean fire ()

    Notifies the subscribers. The callback functions will be executed from the context 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

Parámetros:
arguments   an arbitrary set of parameters to pass to the handler.
Retorna:
false if one of the subscribers returned false, true otherwise
subscribe

  void subscribe (<Function> fn, <Object> obj, <boolean|Object> overrideContext)

    Subscribes the caller to this event

Parámetros:
fn   The function to execute
obj   An object to be passed along when the event fires
overrideContext   If true, the obj passed in becomes the execution context of the listener. if an object, that object becomes the the execution context.
toString

  Object toString ()

unsubscribe

  boolean unsubscribe (<Function> fn, <Object> obj)

    Unsubscribes subscribers.

Parámetros:
fn   The subscribed function to remove, if not supplied all will be removed
obj   The custom object passed to subscribe. This is optional, but if supplied will be used to disambiguate multiple listeners that are the same (e.g., you subscribe many object using a function that lives on the prototype)
Retorna:
True if the subscriber was found and detached.
unsubscribeAll

  int unsubscribeAll ()

    Removes all listeners

Retorna:
The number of listeners unsubscribed

Propiedades
Error   lastError

    In order to make it possible to execute the rest of the subscriber stack when one thows an exception, the subscribers exceptions are caught. The most recent exception is stored in this property

object   scope

    The context 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.
    • YAHOO.util.CustomEvent.LIST:
      • param1: event name
      • param2: array of arguments sent to fire
      • param3: a custom object supplied by the subscriber
    • YAHOO.util.CustomEvent.FLAT
      • param1: the first argument passed to fire. If you need to pass multiple parameters, use and array or object literal
      • param2: a custom object supplied by the subscriber

boolean   silent

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

YAHOO.util.CustomEvent   subscribeEvent

    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.

Subscriber[]   subscribers

    The subscribers to this event

string   type

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

<static> int   FLAT

    Subscriber listener sigature constant. The FLAT type returns two parameters: the first argument passed to fire and the optional custom object

<static> int   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



Desarrollado por SIU.
Documentación generada con JSDoc