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 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.
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-
The widget which this plugin is to attach to.
Has a corresponding runtime client property.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of InstancePlugin class, or subclass thereof.
-
Identifies an object as an instance of InstancePlugin class, or subclass thereof.
-
The Widget which was passed into the constructor, which is the Widget we are providing extra services for.
Has a corresponding client config.
Functions
Functions are methods available for calling on the class-
updateKeyMap( )private
This will merge a feature's (subclass of InstancePlugin) keyMap with it's client's keyMap.