An augmentable class, which provides the augmented class with the ability to host plugins. It adds plug and unplug methods to the augmented class, which can be used to add or remove plugins from instances of the class.
Plugins can also be added through the constructor configuration object passed to the host class' constructor using the "plugins" property. Supported values for the "plugins" property are those defined by the plug method. For example the following code would add the AnimPlugin and IOPlugin to Overlay (the plugin host):
Plug.Host's protected _initPlugins and _destroyPlugins methods should be invoked by the host class at the appropriate point in the host's lifecyle.
private
void
_initPlugins
(
config
)
config
<Config>
The configuration object with property name/value pairs.
boolean
hasPlugin
(
ns
)
ns
<String>
The plugin's namespace
boolean
Base
plug
(
P
,
config
)
P
<Function | Object |Array>
Accepts the plugin class, or an
object with a "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 the above function or object values, allowing the user to add multiple plugins in a single call.
config
<object>
(Optional) If the first argument is the plugin class, the second argument
can be the configuration for the plugin.
Base
static
void
Plugin.Host.plug
(
hostClass
,
plugin
,
config
)
hostClass
<Function>
The host class on which to register the plugins
plugin
<Function | Array>
Either the plugin class, an array of plugin classes or an array of objects (with fn and cfg properties defined)
config
<Object>
(Optional) If plugin is the plugin class, the configuration for the plugin
static
void
Plugin.Host.unplug
(
hostClass
,
plugin
)
hostClass
<Function>
The host class from which to unregister the plugins
plugin
<Function | Array>
The plugin class, or an array of plugin classes
Base
unplug
(
plugin
)
plugin
<String | Function>
The namespace of the plugin, or the plugin class with the static NS namespace property defined. If not provided,
all registered plugins are unplugged.
Base