Audio context this binding

This commit is contained in:
Will Scullin 2021-04-25 12:09:30 -07:00
parent 66d8fdc2c2
commit 6c4844cb87
No known key found for this signature in database
GPG Key ID: 26DCD1042C6638CD

View File

@ -86,7 +86,7 @@ export class Audio implements OptionHandler {
} }
autoStart() { autoStart = () => {
if (this.audioContext && !this.started) { if (this.audioContext && !this.started) {
this.samples = []; this.samples = [];
this.audioContext.resume(); this.audioContext.resume();
@ -94,14 +94,14 @@ export class Audio implements OptionHandler {
} }
} }
start() { start = () => {
if (this.audioContext) { if (this.audioContext) {
this.samples = []; this.samples = [];
this.audioContext.resume(); this.audioContext.resume();
} }
} }
isEnabled() { isEnabled = () => {
return this.sound; return this.sound;
} }
@ -121,7 +121,7 @@ export class Audio implements OptionHandler {
]; ];
} }
setOption(name: string, value: boolean) { setOption = (name: string, value: boolean) => {
switch (name) { switch (name) {
case SOUND_ENABLED_OPTION: case SOUND_ENABLED_OPTION:
this.sound = value; this.sound = value;