Fix demo again

This commit is contained in:
Simon Lamon
2022-10-09 11:29:33 +00:00
parent 0ba12301a6
commit bd661fdb07
3 changed files with 16 additions and 7 deletions
+3 -1
View File
@@ -25,7 +25,9 @@ export class CanvasAddon extends Disposable implements ITerminalAddon {
public activate(terminal: Terminal): void {
const core = (terminal as any)._core;
if (!terminal.element) {
this.register(core.onWillOpen(() => this.activate(terminal)));
this.register(toDisposable(() => {
core.onWillOpen(() => this.activate(terminal));
}));
return;
}
+3 -1
View File
@@ -33,7 +33,9 @@ export class WebglAddon extends Disposable implements ITerminalAddon {
}
const core = (terminal as any)._core;
if (!terminal.element) {
this.register(core.onWillOpen(() => this.activate(terminal)));
this.register(toDisposable(() => {
core.onWillOpen(() => this.activate(terminal));
}));
return;
}
this._terminal = terminal;
+10 -5
View File
@@ -271,11 +271,16 @@ function createTerminal(): void {
socketURL = protocol + location.hostname + ((location.port) ? (':' + location.port) : '') + '/terminals/';
addons.fit.instance!.fit();
typedTerm.loadAddon(addons.webgl.instance);
setTimeout(() => {
addTextureAtlas(addons.webgl.instance.textureAtlas);
addons.webgl.instance.onChangeTextureAtlas(e => addTextureAtlas(e));
}, 0);
try { // try-catch to allow the demo to load if webgl is not supported
typedTerm.loadAddon(addons.webgl.instance);
setTimeout(() => {
addTextureAtlas(addons.webgl.instance.textureAtlas);
addons.webgl.instance.onChangeTextureAtlas(e => addTextureAtlas(e));
}, 0);
}
catch {
addons.webgl.instance = undefined;
}
term.open(terminalContainer);
term.focus();