Skip to content

EZ Web Audio / AudioEventSource

Type Alias: AudioEventSource

AudioEventSource = BaseSound | BeatTrack | GrainPlayer | LayeredSound | PolySynth | Sequence | Transport

Defined in: packages/core/src/events/event-types.ts:31

Union of all classes that emit events in ez-web-audio.

Event detail source fields are typed as AudioEventSource instead of unknown. Use instanceof checks to narrow to a specific class:

Example

typescript
sound.on('play', (e) => {
  if (e.detail.source instanceof Sound) {
    console.log('played by a Sound')
  }
})