YUI recommends YUI3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

This documentation is no longer maintained.

Yahoo! UI Library

Event Utility  2.9.0

Yahoo! UI Library > event > YAHOO.util.Subscriber
Search:
 
Filters

Class YAHOO.util.Subscriber

Stores the subscriber information to be used when the event fires.

Constructor

YAHOO.util.Subscriber ( fn , obj , overrideContext )
Parameters:
fn <Function> The function to execute
obj <Object> An object to be passed along when the event fires
overrideContext <boolean> If true, the obj passed in becomes the execution context of the listener

Properties

fn - function

The callback that will be execute when the event fires

obj - object

An optional custom object that will passed to the callback when the event fires

overrideContext - boolean|object

The default execution context for the event listener is defined when the event is created (usually the object which contains the event). By setting overrideContext to true, the execution context becomes the custom object passed in by the subscriber. If overrideContext is an object, that object becomes the context.

Methods

contains

boolean contains ( fn , obj )
Returns true if the fn and obj match this objects properties. Used by the unsubscribe method to match the right subscriber.
Parameters:
fn <Function> the function to execute
obj <Object> an object to be passed along when the event fires
Returns: boolean
true if the supplied arguments match this subscriber's signature.

getScope

void getScope ( defaultScope )
Returns the execution context for this listener. If overrideContext was set to true the custom obj will be the context. If overrideContext is an object, that is the context, otherwise the default context will be used.
Parameters:
defaultScope <Object> the context to use if this listener does not override it.

toString

void toString ( )


Copyright © 2011 Yahoo! Inc. All rights reserved.