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

create(params: Object)

Plugin definition factory

public

Destroy the plugin instance

public

init()

Initialise the plugin

Inherited Summary

From class Observer
public
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

Disable firing a list of events by name.

since 4.0.0
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) 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.

It returns a PluginDefinition object representing the plugin.

Params:

NameTypeAttributeDescription
params Object
  • default: {}

The plugin params (specific to 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)