[ árbol de herencia ] [ índice general ]

YAHOO.util.EventProvider


Object
   |
   +--YAHOO.util.EventProvider

Ubicada en yahoo.js

Métodos
CustomEvent createEvent(p_type, p_config) Creates a new custom event of the specified type.
boolean fireEvent(p_type, arg1, arg2, etc) Fire a custom event by name.
Object hasEvent(type) Returns true if the custom event of the provided type has been created with createEvent.
void subscribe(p_type, p_fn, p_obj, overrideContext) Subscribe to a CustomEvent by event type
boolean unsubscribe(p_type, p_fn, p_obj) Unsubscribes one or more listeners the from the specified event
Object unsubscribeAll(p_type) Removes all listeners from the specified event.

YAHOO.util.EventProvider

  YAHOO.util.EventProvider ()

    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.

createEvent

  CustomEvent createEvent (p_type, p_config)

    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.

Parámetros:
p_type   {string} the type, or name of the event
p_config   {object} optional config params. Valid properties are:
  • YAHOO.util.EventProvider.prototype.scope = defines;the default execution scope. If not defined the default scope will be this instance.
  • YAHOO.util.EventProvider.prototype.silent = if;true, the custom event will not generate log messages. This is false by default.
  • YAHOO.util.EventProvider.prototype.onSubscribeCallback = specifies;a callback to execute when the event has a new subscriber. This will fire immediately for each queued subscriber if any exist prior to the creation of the event.
Retorna:
the custom event
fireEvent

  boolean fireEvent (p_type, arg1, arg2, etc)

    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

Parámetros:
p_type   {string} the type, or name of the event
arguments   {Object*} an arbitrary set of parameters to pass to the handler.
Retorna:
the return value from CustomEvent.fire
hasEvent

  Object hasEvent (type)

    Returns true if the custom event of the provided type has been created with createEvent.

Parámetros:
type   {string} the type, or name of the event
subscribe

  void subscribe (p_type, p_fn, p_obj, overrideContext)

    Subscribe to a CustomEvent by event type

Parámetros:
p_type   {string} the type, or name of the event
p_fn   {function} the function to exectute when the event fires
p_obj   {Object} An object to be passed along when the event fires
overrideContext   {boolean} If true, the obj passed in becomes the execution scope of the listener
unsubscribe

  boolean unsubscribe (p_type, p_fn, p_obj)

    Unsubscribes one or more listeners the from the specified event

Parámetros:
p_type   {string} The type, or name of the event. If the type is not specified, it will attempt to remove the listener from all hosted events.
p_fn   {Function} The subscribed function to unsubscribe, if not supplied, all subscribers will be removed.
p_obj   {Object} 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

  Object unsubscribeAll (p_type)

    Removes all listeners from the specified event. If the event type is not specified, all listeners from all hosted custom events will be removed.

Parámetros:
p_type   {string} The type, or name of the event



Desarrollado por SIU.
Documentación generada con JSDoc