Emitter < EventType >

  • EventType: string

Emitter gives classes which extend it the ability to listen for and emit events. Inspiration and reference from Jerome Etienne's MicroEvent. MIT (c) 2011 Jerome Etienne.

Hierarchy

Index

Properties

debug #

boolean

Set this debug flag to log all events that happen in this class.

disposed #

readonly boolean

Indicates if the instance was disposed. 'Disposing' an instance means that all of the Web Audio nodes that were created for the instance are disconnected and freed for garbage collection.

name #

string

static version #

string

The version number semver

Methods

dispose #

Clean up

dispose ( ) => this

emit #

Invoke all of the callbacks bound to the event with any arguments passed in.

emit (
event:any ,

The name of the event.

...args:any []

The arguments to pass to the functions listening.

) => this

static getDefaults #

Returns all of the default options belonging to the class.

getDefaults ( ) => BaseToneOptions

static mixin #

Add Emitter functions (on/off/emit) to the object

mixin (
constr:any
) => void

off #

Remove the event listener.

off (
event:EventType ,

The event to stop listening to.

callback?:undefined | (args) => void

The callback which was bound to the event with Emitter.on.If no callback is given, all callbacks events are removed.

) => this

on #

Bind a callback to a specific event.

on (
event:EventType ,

The name of the event to listen for.

callback:(args) => void

The callback to invoke when the event is emitted

) => this

once #

Bind a callback which is only invoked once

once (
event:EventType ,

The name of the event to listen for.

callback:(args) => void

The callback to invoke when the event is emitted

) => this

toString #

Convert the class to a string


import { Oscillator } from "tone";
const osc = new Oscillator();
console.log(osc.toString());
toString ( ) => string