(context: BaseAudioContext)
| 19 | static #workletUrl: Option<string> = Option.None |
| 20 | |
| 21 | static async createFor(context: BaseAudioContext): Promise<AudioWorklets> { |
| 22 | return context.audioWorklet.addModule(this.#workletUrl.unwrap("WorkletUrl is missing (call 'install' first)")).then(() => { |
| 23 | const worklets = new AudioWorklets(context) |
| 24 | this.#map.set(context, worklets) |
| 25 | return worklets |
| 26 | }) |
| 27 | } |
| 28 | |
| 29 | static get(context: BaseAudioContext): AudioWorklets {return asDefined(this.#map.get(context), "Worklets not installed")} |
| 30 |