Skip to content

Commit

Permalink
Merge remote-tracking branch 'ups/v3' into 898_explicit_typings
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Aug 19, 2017
2 parents c984013 + f251047 commit a0d8e3c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
this.viewport.syncScrollArea();
break;
case 'tabStopWidth': this.setupStops(); break;
case 'bellStyle': this.preloadBellSound(); break;
case 'bellSound':
case 'bellStyle': this.syncBellSound(); break;
}
}

Expand Down Expand Up @@ -683,7 +684,7 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
this.viewportElement.appendChild(this.viewportScrollArea);

// preload audio
this.preloadBellSound();
this.syncBellSound();

// Create the selection container.
this.selectionContainer = document.createElement('div');
Expand Down Expand Up @@ -2270,8 +2271,10 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
this.options.bellStyle === 'both';
}

private preloadBellSound(): void {
if (this.soundBell()) {
private syncBellSound(): void {
if (this.soundBell() && this.bellAudioElement) {
this.bellAudioElement.setAttribute('src', this.options.bellSound);
} else if (this.soundBell()) {
this.bellAudioElement = document.createElement('audio');
this.bellAudioElement.setAttribute('preload', 'auto');
this.bellAudioElement.setAttribute('src', this.options.bellSound);
Expand Down

0 comments on commit a0d8e3c

Please sign in to comment.