Home Reference Source
public class | source

PluginClass

Extends:

Observer → PluginClass

This is the interface which is implemented by all plugin classes. Note that this only turns into an observer after being passed through wavesurfer.addPlugin.

Constructor Summary

Public Constructor
public

constructor(params: Object, ws: Object)

Construct the plugin

Method Summary

Public Methods
public

Plugin definition factory

public

Destroy the plugin instance

public

init()

Initialise the plugin

Inherited Summary

From class Observer
public

fireEvent(event: string, args: ...any)

Manually fire an event

public

Attach a handler function for an event.

public

once(event: string, handler: function): ListenerDescriptor

Attach a handler to an event.

public

un(event: string, fn: function)

Remove an event handler.

public

unAll()

Remove all event handlers.

Public Constructors

public constructor(params: Object, ws: Object) source

Construct the plugin

Override:

Observer#constructor

Params:

NameTypeAttributeDescription
params Object
  • default: {}

The plugin params (specific to the plugin)

ws Object

The wavesurfer instance

Public Methods

public create(params: Object): PluginDefinition source

Plugin definition factory

This function must be used to create a plugin definition which can be used by wavesurfer to correctly instantiate the plugin.

Params:

NameTypeAttributeDescription
params Object
  • default: {}

The plugin params (specific to the plugin)

Return:

PluginDefinition

an object representing the plugin

public destroy() source

Destroy the plugin instance

Stop doing something. This is called by wavesurfer.destroyPlugin(pluginName)

public init() source

Initialise the plugin

Start doing something. This is called by wavesurfer.initPlugin(pluginName)