Emitter
class Core ↳ extends Tone
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.
Properties
Section titled “Properties”Methods
Section titled “Methods”emit()
Section titled “emit()”emit(event: EventType, ...args: any[]): thisInvoke all of the callbacks bound to the event with any arguments passed in.
Parameters
-
event
EventTypeThe name of the event.
-
args
any[]The arguments to pass to the functions listening.
Returns this
off(event: EventType, callback?: (...args: any[]) => void): thisRemove the event listener.
Parameters
-
event
EventTypeThe event to stop listening to.
-
callback
(…args: any[]) => voidoptionalThe callback which was bound to the event with Emitter.on. If no callback is given, all callbacks events are removed.
Returns this
on(event: EventType, callback: (...args: any[]) => void): thisBind a callback to a specific event.
Parameters
-
event
EventTypeThe name of the event to listen for.
-
callback
(…args: any[]) => voidThe callback to invoke when the event is emitted
Returns this
once()
Section titled “once()”once(event: EventType, callback: (...args: any[]) => void): thisBind a callback which is only invoked once
Parameters
-
event
EventTypeThe name of the event to listen for.
-
callback
(…args: any[]) => voidThe callback to invoke when the event is emitted
Returns this
mixin()
Section titled “mixin()”static
mixin(constr: any): voidAdd Emitter functions (on/off/emit) to the object
Parameters
- constr
any
Inherited members
Section titled “Inherited members”- From
Tone: constructor, debug, version, disposed, toString(), getDefaults()