Merge pull request #906 from npezza93/sync-bell-sound-on-change

When bellSound changes, update the bellAudioElements src
This commit is contained in:
Daniel Imms
2017-08-19 16:40:08 -07:00
committed by GitHub
2 changed files with 8 additions and 4 deletions
+7 -4
View File
@@ -485,7 +485,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;
}
}
@@ -694,7 +695,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');
@@ -2293,8 +2294,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);
+1
View File
@@ -31,6 +31,7 @@ export type BooleanOption =
export type StringOption =
'cursorStyle' |
'bellStyle' |
'bellSound' |
'termName';
export type StringArrayOption = 'colors';
export type NumberOption =