InstancePlugin
Plugin
Base class for plugins. Published functions will be available from the other class. this in published functions is referenced to the plugin, access the other class using this.client.
Observe that a plugin doesn't apply itself on class level but instead on instance level. Plugin is its own instance that can have own functions and data that is not exposed to target class.
For a comprehensive guide on creating custom features (plugins), see the Creating custom features guide.
Functions can be published in four ways:
assign(when function is not already available on target)before(when function is already available on target, will be called before original function)after(when function is already available on target, will be called after original function)override(replaces function on target, but old function can be reached)
To configure which functions get published and in what way, specify pluginConfig getter on plugin:
class Sort extends InstancePlugin {
static get pluginConfig {
return {
before : ['init'],
after : ['destroy', 'onElementClick'],
override : ['render']
};
}
}
Useful configs and properties
| Config / Property | Description |
|---|---|
| disabled | The plugin disabled state |
| client | Reference to the owning widget |
See also
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Internal listeners, that cannot be removed by the user.
-
The widget which this plugin is to attach to.
Has a corresponding runtime client property.
-
Set to
falseto disable localization of this object.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of Events class, or subclass thereof.
-
Identifies an object as an instance of InstancePlugin class, or subclass thereof.
-
Identifies an object as an instance of Localizable class, or subclass thereof.
-
A class property getter for the default values of internal properties for this class.
-
An empty array that can be used as a default value.
-
An empty object that can be used as a default value.
-
Identifies an object as an instance of InstancePlugin class, or subclass thereof.
-
Returns a copy of the full configuration which was used to configure this object.
-
This property is set to
truebefore theconstructorreturns. -
This property is set to
trueon entry to the destroy method. It remains on the objects after returning fromdestroy(). If isDestroyed istrue, this property will also betrue, so there is no need to test for both (for example,comp.isDestroying || comp.isDestroyed). -
The Widget which was passed into the constructor, which is the Widget we are providing extra services for.
Has a corresponding client config.
-
Get the global LocaleHelper
-
Get the global LocaleManager
Functions
Functions are methods available for calling on the class-
This optional class method is called when a class is mixed in using the mixin() method.
-
Registers this class type with its Factory
-
updateKeyMap( )private
This will merge a feature's (subclass of InstancePlugin) keyMap with it's client's keyMap.
-
Internal function used to hook destroy() calls when using thisObj
-
Internal function used restore hooked destroy() calls when using thisObj
-
Auto detaches listeners registered from start, if set as detachable
-
Internal function used to run a callback function after an event is triggered
-
Removes all listeners registered to this object by the application.