Observer
Direct Subclass:
Indirect Subclass:
Observer class
Constructor Summary
Public Constructor | ||
public |
Instantiate Observer |
Member Summary
Public Members | ||
public |
handlers: * |
Method Summary
Public Methods | ||
public |
Manually fire an event |
|
public |
on(event: string, fn: function): ListenerDescriptor Attach a handler function for an event. |
|
public |
once(event: string, handler: function): ListenerDescriptor Attach a handler to an event. |
|
public |
setDisabledEventEmissions(eventNames: string[]) Disable firing a list of events by name. |
since 4.0.0 |
public |
Remove an event handler. |
|
public |
unAll() Remove all event handlers. |
Public Constructors
Public Members
public handlers: * source
Public Methods
public fireEvent(event: string, args: ...any) source
Manually fire an event
Params:
Name | Type | Attribute | Description |
event | string | The event to fire manually |
|
args | ...any | The arguments with which to call the listeners |
public on(event: string, fn: function): ListenerDescriptor source
Attach a handler function for an event.
public once(event: string, handler: function): ListenerDescriptor source
Attach a handler to an event. The handler is executed at most once per event type.
public setDisabledEventEmissions(eventNames: string[]) since 4.0.0 source
Disable firing a list of events by name. When specified, event handlers for any event type passed in here will not be called.
Params:
Name | Type | Attribute | Description |
eventNames | string[] | an array of event names to disable emissions for |
Example:
// disable seek and interaction events
wavesurfer.setDisabledEventEmissions(['seek', 'interaction']);