# Yahoo! UI Library

### plugin 3.0.0b1

Yahoo! UI Library > plugin > Plugin.Base
Search:
Filters
Show Private Show Protected Show Deprecated

## Class Plugin.Base - extends Base

Known Subclasses:
  DataSourceXMLSchema DataSourceArraySchema DataSourceJSONSchema Cache DataSourceTextSchema

The base class for all Plugin instances.

### Properties

#### _handles - `private Array`

The list of event handles for event listeners or AOP injected methods applied by the plugin to the host object.

#### Plugin.Base.ATTRS - `static Object`

Object defining the set of attributes supported by the Plugin.Base class

#### Plugin.Base.NAME - `static String`

The string identifying the Plugin.Base class. Plugins extending Plugin.Base should set their own NAME value.

#### Plugin.NS - `static String`

The name of the property the the plugin will be attached to when plugged into a Plugin Host. Plugins extending Plugin.Base, should set their own NS value.

#### Properties inherited from Attribute:

``

#### Properties inherited from Base:

`name`

### Methods

#### destructor

`void destructor ( )`
Destructor lifecycle implementation. Removes any event listeners or injected methods applied by the Plugin

Returns: `void`

#### doAfter

`EventHandle doAfter ( sFn , fn , context )`
Listens for the "after" moment of events fired by the host, or injects code "after" a given method on the host.

Parameters:
  `sFn <String>` The event to listen for, or method to inject logic after.
  `fn <Function>` The handler function. For events, the "after" moment listener. For methods, the function to execute after the given method is executed.
  `context <Object>` An optional context to call the handler with. The default context is the plugin instance.

Returns: `EventHandle`
  handle The detach handle for the handler.

#### doBefore

`EventHandle doBefore ( sFn , fn , context )`
Listens for the "on" moment of events fired by the host, or injects code "before" a given method on the host.

Parameters:
  `sFn <String>` The event to listen for, or method to inject logic before.
  `fn <Function>` The handler function. For events, the "on" moment listener. For methods, the function to execute before the given method is executed.
  `context <Object>` An optional context to call the handler with. The default context is the plugin instance.

Returns: `EventHandle`
  handle The detach handle for the handler.

#### initializer

`void initializer ( config )`
Initializer lifecycle implementation.

Parameters:
  `config <Object>` Configuration object with property name/value pairs.

Returns: `void`

#### Methods inherited from EventTarget:

`_getType, _parseType, addTarget, after, before, bubble, detach, detachAll, fire, getEvent, on, publish, removeTarget, subscribe, unsubscribe, unsubscribeAll`

#### Methods inherited from Attribute:

`_addAttrs, _addLazyAttr, _defAttrChangeFn, _fireAttrChange, _getAttrInitVal, _isLazyAttr, _set, _setAttr, _setAttrVal, _splitAttrVals, addAttr, addAttrs, attrAdded, get, getAttrs, modifyAttr, removeAttr, reset, set, setAttrs`

#### Methods inherited from Plugin.Host:

`_destroyPlugins, _initPlugins, _plug, _unplug, hasPlugin, plug, unplug`

#### Methods inherited from Base:

`_aggregateAttrs, _defDestroyFn, _defInitFn, _destroyHierarchy, _filterAttrCfs, _getAttrCfgs, _getClasses, _initHierarchy, _initHierarchyData, destroy, init, toString`

### Events

#### hostChange

`hostChange ( event )`
Fires when the value for the configuration attribute 'host' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### Events inherited from Base:

`destroy, destroyedChange, init, initializedChange,`

### Configuration Attributes

#### host `- writeonce Plugin.Host`

The plugin's host object.

#### Configuration attributes inherited from Base:

`destroyed, initialized,`

Copyright © 2009 Yahoo! Inc. All rights reserved.