Class Plugin.Base
- extends Base
- Known Subclasses:
-
DataSourceXMLSchema
DataSourceArraySchema
DataSourceJSONSchema
Plugin.WidgetAnim
Plugin.ScrollViewPaginator
Plugin.ScrollViewScrollbars
DataSourceTextSchema
The base class for all Plugin instances.
Properties
The list of event handles for event listeners or AOP injected methods
applied by the plugin to the host object.
Object defining the set of attributes supported by the Plugin.Base class
The string identifying the Plugin.Base class. Plugins extending
Plugin.Base should set their own NAME value.
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 Base:
Methods
EventHandle
afterHostEvent
(
type
,
fn
,
context
)
Listens for the "after" moment of events fired by the host object.
Listeners attached through this method will be detached when the plugin is unplugged.
- Parameters:
-
type
<String | Object>
The event type.
-
fn
<Function>
The listener.
-
context
<Object>
The execution context. Defaults to the plugin instance.
- Returns:
EventHandle
- handle The detach handle for the listener.
EventHandle
afterHostMethod
(
The
,
fn
,
context
)
Injects a function to be executed after a given method on host object.
The function will be detached when the plugin is unplugged.
- Parameters:
-
The
<String>
name of the method to inject the function after.
-
fn
<Function>
The function to inject.
-
context
<Object>
The execution context. Defaults to the plugin instance.
- Returns:
EventHandle
- handle The detach handle for the injected function.
EventHandle
beforeHostMethod
(
The
,
fn
,
context
)
Injects a function to be executed before a given method on host object.
The function will be detached when the plugin is unplugged.
- Parameters:
-
The
<String>
name of the method to inject the function before.
-
fn
<Function>
The function to inject.
-
context
<Object>
The execution context. Defaults to the plugin instance.
- Returns:
EventHandle
- handle The detach handle for the injected function.
void
destructor
(
)
Destructor lifecycle implementation.
Removes any event listeners or injected methods applied by the Plugin
EventHandle
doAfter
(
strMethod
,
fn
,
context
)
Listens for the "after" moment of events fired by the host,
or injects code "after" a given method on the host.
- Parameters:
-
strMethod
<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 listener.
EventHandle
doBefore
(
strMethod
,
fn
,
context
)
Listens for the "on" moment of events fired by the host,
or injects code "before" a given method on the host.
- Parameters:
-
strMethod
<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.
void
initializer
(
config
)
Initializer lifecycle implementation.
- Parameters:
-
config
<Object>
Configuration object with property name/value pairs.
EventHandle
onHostEvent
(
type
,
fn
,
context
)
Listens for the "on" moment of events fired by the host object.
Listeners attached through this method will be detached when the plugin is unplugged.
- Parameters:
-
type
<String | Object>
The event type.
-
fn
<Function>
The listener.
-
context
<Object>
The execution context. Defaults to the plugin instance.
- Returns:
EventHandle
- handle The detach handle for the listener.
Methods inherited from EventTarget:
_getType,
_monitor,
_parseType,
addTarget,
after,
before,
bubble,
detach,
detachAll,
fire,
getEvent,
getTargets,
on,
once,
publish,
removeTarget,
subscribe,
unsubscribe,
unsubscribeAll
Methods inherited from Attribute:
_addAttrs,
_addLazyAttr,
_defAttrChangeFn,
_fireAttrChange,
_getAttr,
_getAttrCfg,
_getAttrInitVal,
_getAttrs,
_getStateVal,
_isLazyAttr,
_normAttrVals,
_protectAttrs,
_set,
_setAttr,
_setAttrs,
_setAttrVal,
_setStateVal,
addAttr,
addAttrs,
attrAdded,
get,
getAttrs,
modifyAttr,
removeAttr,
reset,
set,
setAttrs
Methods inherited from Base:
_aggregateAttrs,
_defDestroyFn,
_defInitFn,
_destroyHierarchy,
_filterAttrCfs,
_getAttrCfgs,
_getClasses,
_initHierarchy,
_initHierarchyData,
_preInitEventCfg,
destroy,
init,
toString
Events
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:
Configuration Attributes
host
- writeonce Plugin.Host
The plugin's host object.
Configuration attributes inherited from Base: