Print Friendly

# Class YAHOO.util.Subscriber

Package: | YAHOO.util
Class: | Subscriber
Extends: | Object
Defined In: | event.js

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

## Public Properties

Property | Defined By
--- | ---
| fn : function | Subscriber
The callback that will be execute when the event fires
| obj : object | Subscriber
An optional custom object that will passed to the callback when the event fires
| override : boolean|object | Subscriber
The default execution scope for the event listener is defined when the event is created (usually the object which con...

## Public Methods

Method | Defined By
--- | ---
| Subscriber() | Subscriber
| contains(`Function fn`, `Object obj`) : boolean | Subscriber
Returns true if the fn and obj match this objects properties. Used by the unsubscribe method to match the right subsc...
| getScope(`Object defaultScope`) : void | Subscriber
Returns the execution scope for this listener. If override was set to true the custom obj will be the scope. If ove...
| toString() : void | Subscriber

## Public Events

This class has no public events.

## Property Details

### fn

`public function fn`
The callback that will be execute when the event fires
This property is defined by Subscriber.

### obj

`public object obj`
An optional custom object that will passed to the callback when the event fires
This property is defined by Subscriber.

### override

`public boolean|object override`
The default execution scope for the event listener is defined when the event is created (usually the object which contains the event). By setting override to true, the execution scope becomes the custom object passed in by the subscriber. If override is an object, that object becomes the scope.
This property is defined by Subscriber.

## Constructor Details

### Subscriber

`public function Subscriber()`
Parameters:

- None.

## Method Details

### contains

`public function contains(`Function fn`, `Object 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.

This method is defined by Subscriber.

### getScope

`public function getScope(`Object defaultScope`)`
Returns the execution scope for this listener. If override was set to true the custom obj will be the scope. If override is an object, that is the scope, otherwise the default scope will be used.
Parameters:

- `defaultScope` : Object
  the scope to use if this listener does not override it.

Returns:

- `void`

This method is defined by Subscriber.

### toString

`public function toString()`
Parameters:

- None.

Returns:

- `void`

This method is defined by Subscriber.

yui-ext - Copyright © 2006 Jack Slocum. | Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.