PluginHost.html revision f73ad5455705c598d672a4211a16a262a598a7ed
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>API: base PluginHost (YUI Library)</title>
<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" />
<link rel="stylesheet" type="text/css" href="assets/api.css" />
<script type="text/javascript" src="assets/api-js"></script>
<script type="text/javascript" src="assets/ac-js"></script>
</head>
<body id="yahoo-com">
<div id="doc3" class="yui-t2">
<div id="hd">
<h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1>
<h3>base&nbsp; <span class="subtitle">3.0.0b1</span></h3>
<a href="/index.html" title="Yahoo! UI Library">Yahoo! UI Library</a>
&gt; <a href="/module_base.html" title="base">base</a>
&gt; PluginHost
<form onsubmit="return false">
<div id="propertysearch">
Search: <input autocomplete="off" id="searchinput" />
<div id="searchresults">
&nbsp;
</div>
</div>
</form>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
<fieldset>
<legend>Filters</legend>
<span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
<span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
<span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
</fieldset>
</form>
<h2>
Class <b property="yui:name">PluginHost</b>
<span class="extends">
</span>
</h2>
<!-- class tree goes here -->
<div class="summary description" property="yui:description">
<p>
An augmentable class, which when augmented onto a Base based class, allows
the class to support plugins, providing plug and unplug methods and the ability
to add plugins through the configuration literal passed to the constructor.
</p>
<p>
The PlugHost's _initPlugins() and _destroyPlugins() methods should be invoked by the
host class at the appropriate point in the instance's lifecyle. This is done
by default for the Base class, so developers extending base don't need to do
anything to get plugin support.
</p>
</div>
<div rel="yui:properties" resource="#properties">
</div>
<div rel="yui:methods" resource="#methods">
<div class="section method details">
<h3 id="methods">Methods</h3>
<div class="content">
<div class="private" rel="yui:method" resource="#method__destroyPlugins">
<h4>
<a name="method__destroyPlugins">_destroyPlugins</a></h4>
<div class="detail" >
<code>
private
void
<strong property="yui:name">_destroyPlugins</strong>
(
)
</code>
<div class="description" property="yui:description">
Unplugs and destroys all plugins on the host
</div>
<div class="description">
<dl>
<dt>Returns:
<code property="yui:return">
void
</code></dt>
<dd property="yui:returnInfo"></dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="private" rel="yui:method" resource="#method__initPlugins">
<h4>
<a name="method__initPlugins">_initPlugins</a></h4>
<div class="detail" >
<code>
private
void
<strong property="yui:name">_initPlugins</strong>
(
config
)
</code>
<div class="description" property="yui:description">
Initializes static plugins registered on the host (using the
Base.plug static method) and any plugins passed to the
instance through the "plugins" configuration property.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">config</span>
&lt;<span property="yui:type">Config</span>&gt;
</code>
<span property="yui:description"> The configuration object literal for the host.</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
void
</code></dt>
<dd property="yui:returnInfo"></dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="private" rel="yui:method" resource="#method__plug">
<h4>
<a name="method__plug">_plug</a></h4>
<div class="detail" >
<code>
private
void
<strong property="yui:name">_plug</strong>
(
PluginClass
,
config
)
</code>
<div class="description" property="yui:description">
Private method used to instantiate and attach plugins to the host
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">PluginClass</span>
&lt;<span property="yui:type">Function</span>&gt;
</code>
<span property="yui:description"> The plugin class to instantiate</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">config</span>
&lt;<span property="yui:type">Object</span>&gt;
</code>
<span property="yui:description"> The configuration object for the plugin</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
void
</code></dt>
<dd property="yui:returnInfo"></dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="private" rel="yui:method" resource="#method__unplug">
<h4>
<a name="method__unplug">_unplug</a></h4>
<div class="detail" >
<code>
private
void
<strong property="yui:name">_unplug</strong>
(
plugin
)
</code>
<div class="description" property="yui:description">
Unplugs and destroys a plugin already instantiated with the host.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">plugin</span>
&lt;<span property="yui:type">String | Function</span>&gt;
</code>
<span property="yui:description"> The namespace for the plugin, or a plugin class with the static NS property defined.</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
void
</code></dt>
<dd property="yui:returnInfo"></dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_hasPlugin">
<h4>
<a name="method_hasPlugin">hasPlugin</a></h4>
<div class="detail" >
<code>
boolean
<strong property="yui:name">hasPlugin</strong>
(
The
)
</code>
<div class="description" property="yui:description">
Determines if a plugin has plugged into this host.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">The</span>
&lt;<span property="yui:type">object</span>&gt;
</code>
<span property="yui:description"> plugin's namespace</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
boolean
</code></dt>
<dd property="yui:returnInfo">returns true, if the plugin has been plugged into this host, false otherwise.</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_plug">
<h4>
<a name="method_plug">plug</a></h4>
<div class="detail" >
<code>
Base
<strong property="yui:name">plug</strong>
(
p
,
config
)
</code>
<div class="description" property="yui:description">
Adds a plugin to the host object. This will instantiate the
plugin and attach it to the configured namespace on the host object.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">p</span>
&lt;<span property="yui:type">Function | Object |Array</span>&gt;
</code>
<span property="yui:description"> Accepts the plugin class, or an
object literal with a "fn" property specifying the plugin class and
a "cfg" property specifying the configuration for the Plugin.
<p>
Additionally an Array can also be passed in, with the above function or
object literal values, allowing the user to add multiple plugins in a single call.
</p></span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">config</span>
&lt;<span property="yui:type">object</span>&gt;
</code>
<span property="yui:description"> (Optional) If the first argument is the plugin class, the second argument
can be the configuration for the plugin.</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
Base
</code></dt>
<dd property="yui:returnInfo">A reference to the host object</dd>
</dl>
<div class="chainable">
<strong>Chainable:</strong> This method is chainable.
</div>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_PluginHost.plug">
<h4>
<a name="method_PluginHost.plug">PluginHost.plug</a></h4>
<div class="detail" >
<code>
static
void
<strong property="yui:name">PluginHost.plug</strong>
(
hostClass
,
plugin
,
config
)
</code>
<div class="description" property="yui:description">
Registers plugins to be instantiated at the class level (plugins
which should be plugged into every instance of the class by default).
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">hostClass</span>
&lt;<span property="yui:type">Function</span>&gt;
</code>
<span property="yui:description"> The host class on which to register the plugins</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">plugin</span>
&lt;<span property="yui:type">Function | Array</span>&gt;
</code>
<span property="yui:description"> Either the plugin class, an array of plugin classes or an array of object literals (with fn and cfg properties defined)</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">config</span>
&lt;<span property="yui:type">Object</span>&gt;
</code>
<span property="yui:description"> (Optional) If plugin is the plugin class, the configuration for the plugin</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
void
</code></dt>
<dd property="yui:returnInfo"></dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_PluginHost.unplug">
<h4>
<a name="method_PluginHost.unplug">PluginHost.unplug</a></h4>
<div class="detail" >
<code>
static
void
<strong property="yui:name">PluginHost.unplug</strong>
(
hostClass
,
plugin
)
</code>
<div class="description" property="yui:description">
Unregisters any class level plugins which have been registered by the host class, or any
other class in the hierarchy.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">hostClass</span>
&lt;<span property="yui:type">Function</span>&gt;
</code>
<span property="yui:description"> The host class from which to unregister the plugins</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">plugin</span>
&lt;<span property="yui:type">Function | Array</span>&gt;
</code>
<span property="yui:description"> The plugin class, or an array of plugin classes</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
void
</code></dt>
<dd property="yui:returnInfo"></dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_unplug">
<h4>
<a name="method_unplug">unplug</a></h4>
<div class="detail" >
<code>
Base
<strong property="yui:name">unplug</strong>
(
plugin
)
</code>
<div class="description" property="yui:description">
Removes a plugin from the host object. This will destroy the
plugin instance and delete the namepsace from the host object.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">plugin</span>
&lt;<span property="yui:type">String | Function</span>&gt;
</code>
<span property="yui:description"> The namespace of the plugin, or the plugin class with the static NS namespace property defined. If not provided,
all registered plugins are unplugged.</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
Base
</code></dt>
<dd property="yui:returnInfo">A reference to the host object</dd>
</dl>
<div class="chainable">
<strong>Chainable:</strong> This method is chainable.
</div>
</div>
</div>
<hr />
</div>
</div>
</div>
</div>
<div rel="yui:events" resource="#events">
</div>
<div rel="yui:attributes" resource="#configattributes">
</div>
</div>
</div>
<div class="yui-b">
<div class="nav">
<div id="moduleList" class="module">
<h4>Modules</h4>
<ul class="content">
<li class=""><a href="module_anim.html" title="anim">anim</a></li>
<li class=""><a href="module_attribute.html" title="attribute">attribute</a></li>
<li class="selected"><a href="module_base.html" title="base">base</a></li>
<li class=""><a href="module_cache.html" title="cache">cache</a></li>
<li class=""><a href="module_classnamemanager.html" title="classnamemanager">classnamemanager</a></li>
<li class=""><a href="module_console.html" title="console">console</a></li>
<li class=""><a href="module_console-filters.html" title="console-filters">console-filters</a></li>
<li class=""><a href="module_cookie.html" title="cookie">cookie</a></li>
<li class=""><a href="module_dataschema.html" title="dataschema">dataschema</a></li>
<li class=""><a href="module_datasource.html" title="datasource">datasource</a></li>
<li class=""><a href="module_datatype.html" title="datatype">datatype</a></li>
<li class=""><a href="module_dd.html" title="dd">dd</a></li>
<li class=""><a href="module_dom.html" title="dom">dom</a></li>
<li class=""><a href="module_dump.html" title="dump">dump</a></li>
<li class=""><a href="module_event.html" title="event">event</a></li>
<li class=""><a href="module_event-custom.html" title="event-custom">event-custom</a></li>
<li class=""><a href="module_event-simulate.html" title="event-simulate">event-simulate</a></li>
<li class=""><a href="module_history.html" title="history">history</a></li>
<li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li>
<li class=""><a href="module_io.html" title="io">io</a></li>
<li class=""><a href="module_json.html" title="json">json</a></li>
<li class=""><a href="module_node.html" title="node">node</a></li>
<li class=""><a href="module_node-focusmanager.html" title="node-focusmanager">node-focusmanager</a></li>
<li class=""><a href="module_node-menunav.html" title="node-menunav">node-menunav</a></li>
<li class=""><a href="module_oop.html" title="oop">oop</a></li>
<li class=""><a href="module_overlay.html" title="overlay">overlay</a></li>
<li class=""><a href="module_plugin.html" title="plugin">plugin</a></li>
<li class=""><a href="module_profiler.html" title="profiler">profiler</a></li>
<li class=""><a href="module_queue.html" title="queue">queue</a></li>
<li class=""><a href="module_selector.html" title="selector">selector</a></li>
<li class=""><a href="module_selector-native.html" title="selector-native">selector-native</a></li>
<li class=""><a href="module_slider.html" title="slider">slider</a></li>
<li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li>
<li class=""><a href="module_substitute.html" title="substitute">substitute</a></li>
<li class=""><a href="module_widget.html" title="widget">widget</a></li>
<li class=""><a href="module_widget-position.html" title="widget-position">widget-position</a></li>
<li class=""><a href="module_widget-position-ext.html" title="widget-position-ext">widget-position-ext</a></li>
<li class=""><a href="module_widget-stack.html" title="widget-stack">widget-stack</a></li>
<li class=""><a href="module_widget-stdmod.html" title="widget-stdmod">widget-stdmod</a></li>
<li class=""><a href="module_yui.html" title="yui">yui</a></li>
<li class=""><a href="module_yuitest.html" title="yuitest">yuitest</a></li>
</ul>
</div>
<div id="classList" class="module">
<h4>Classes</h4>
<ul class="content">
<li class=""><a href="Base.html" title="Base">Base</a></li>
<li class="selected"><a href="PluginHost.html" title="PluginHost">PluginHost</a></li>
</ul>
</div>
<div id="fileList" class="module">
<h4>Files</h4>
<ul class="content">
<li class=""><a href="Base.js.html" title="Base.js">Base.js</a></li>
<li class=""><a href="BaseBuild.js.html" title="BaseBuild.js">BaseBuild.js</a></li>
<li class=""><a href="PluginHost.js.html" title="PluginHost.js">PluginHost.js</a></li>
</ul>
</div>
<div id="methodsList" class="module">
<h4>Methods</h4>
<ul class="content">
<li class="private"><a href="#method__destroyPlugins" title="_destroyPlugins">_destroyPlugins</a></li>
<li class="private"><a href="#method__initPlugins" title="_initPlugins">_initPlugins</a></li>
<li class="private"><a href="#method__plug" title="_plug">_plug</a></li>
<li class="private"><a href="#method__unplug" title="_unplug">_unplug</a></li>
<li class=""><a href="#method_hasPlugin" title="hasPlugin">hasPlugin</a></li>
<li class=""><a href="#method_plug" title="plug">plug</a></li>
<li class=""><a href="#method_PluginHost.plug" title="PluginHost.plug">PluginHost.plug</a></li>
<li class=""><a href="#method_PluginHost.unplug" title="PluginHost.unplug">PluginHost.unplug</a></li>
<li class=""><a href="#method_unplug" title="unplug">unplug</a></li>
</ul>
</div>
</div>
</div>
</div>
<div id="ft">
<hr />
Copyright &copy; 2009 Yahoo! Inc. All rights reserved.
</div>
</div>
<script type="text/javascript">
ALL_YUI_PROPS = [{"access": "private", "host": "PluginHost", "name": "_destroyPlugins", "url": "PluginHost.html#method__destroyPlugins", "type": "method"}, {"access": "", "host": "PluginHost", "name": "hasPlugin", "url": "PluginHost.html#method_hasPlugin", "type": "method"}, {"access": "private", "host": "PluginHost", "name": "_initPlugins", "url": "PluginHost.html#method__initPlugins", "type": "method"}, {"access": "private", "host": "PluginHost", "name": "_plug", "url": "PluginHost.html#method__plug", "type": "method"}, {"access": "", "host": "PluginHost", "name": "plug", "url": "PluginHost.html#method_plug", "type": "method"}, {"access": "", "host": "PluginHost", "name": "PluginHost.plug", "url": "PluginHost.html#method_PluginHost.plug", "type": "method"}, {"access": "", "host": "PluginHost", "name": "PluginHost.unplug", "url": "PluginHost.html#method_PluginHost.unplug", "type": "method"}, {"access": "private", "host": "PluginHost", "name": "_unplug", "url": "PluginHost.html#method__unplug", "type": "method"}, {"access": "", "host": "PluginHost", "name": "unplug", "url": "PluginHost.html#method_unplug", "type": "method"}];
</script>
</body>
</html>