From 6b46e0837fc35e9f0f2367bd1475e5274a3be1f1 Mon Sep 17 00:00:00 2001 From: npezza93 Date: Thu, 10 Aug 2017 18:27:05 -0400 Subject: [PATCH] Move preloading bell audio to open() and append it the the terminal element --- src/Terminal.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Terminal.ts b/src/Terminal.ts index 8edb406d..6cda1a6b 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -689,6 +689,14 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT this.viewportScrollArea.classList.add('xterm-scroll-area'); this.viewportElement.appendChild(this.viewportScrollArea); + // preload audio + if (this.options.bellSound) { + this.bellAudioElement = document.createElement('audio'); + this.bellAudioElement.setAttribute('preload', 'auto'); + this.bellAudioElement.setAttribute('src', this.options.bellSound); + this.element.appendChild(this.bellAudioElement); + } + // Create the selection container. this.selectionContainer = document.createElement('div'); this.selectionContainer.classList.add('xterm-selection');