Yahoo! UI Library

widget  3.0.0pr2

Yahoo! UI Library > widget > PluginHost
Search:
 
Filters

Class PluginHost

An augmentable class, which when added to a "Base" based class, allows the class to support Plugins, providing plug and unplug methods and performing instantiation and cleanup during the init and destroy lifecycle phases respectively.

Methods

_destroyPlugins

private void _destroyPlugins ( )
Private method used to unplug and destroy all plugins on the host
Returns: void

_initPlugins

private void _initPlugins ( the )
Initializes static plugins registered on the host (the "PLUGINS" static property) and any plugins passed in for the instance through the "plugins" configuration property.
Parameters:
the <Config> user configuration object for the host.
Returns: void

_plug

private void _plug ( PluginClass , config )
Private method used to instantiate and attach plugins to the host
Parameters:
PluginClass <Function> The plugin class to instantiate
config <Object> The configuration object for the plugin
Returns: void

_unplug

private void _unplug ( ns )
Private method used to unregister and destroy a plugin already instantiated with the host.
Parameters:
ns <String> The namespace key for the Plugin. If not provided, all registered plugins are unplugged.
Returns: void

hasPlugin

Boolean hasPlugin ( )
Determines if a plugin has been registered and instantiated for this widget.
Returns: Boolean
returns true, if the plugin has been applied to this widget.

plug

void plug ( p )
Register and instantiate a plugin with the Widget.
Parameters:
p <String | Object |Array> Accepts the registered namespace for the Plugin or an object literal with an "fn" property specifying the Plugin class and a "cfg" property specifying the configuration for the Plugin.

Additionally an Array can also be passed in, with either the above String or Object literal values, allowing for multiple plugin registration in a single call.

Returns: void
Chainable: This method is chainable.

unplug

void unplug ( ns )
Unregister and destroy a plugin already instantiated with the Widget.
Parameters:
ns <String> The namespace key for the Plugin. If not provided, all registered plugins are unplugged.
Returns: void
Chainable: This method is chainable.


Copyright © 2008 Yahoo! Inc. All rights reserved.