v7.3.0

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

  • Widget - Base widget that hosts plugins
  • Pluggable - Mixin that enables plugin support
No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • client : Widget
    ADVANCED

    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
  • isInstancePlugin : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of InstancePlugin class, or subclass thereof.
  • client : Widget
    READONLY
    ADVANCED

    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.

Events

Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

Event handlers

Event handlers are callbacks called as a result of certain actions in this class

Source path

Core/mixin/InstancePlugin.js

Contents