onRecoverContext -> onContextLoss

This commit is contained in:
meganrogge
2021-04-01 13:32:35 -07:00
parent 47ac4dd9fe
commit b1877b4dc7
2 changed files with 6 additions and 11 deletions
@@ -42,8 +42,8 @@ export class WebglRenderer extends Disposable implements IRenderer {
private _onRequestRedraw = new EventEmitter<IRequestRedrawEvent>();
public get onRequestRedraw(): IEvent<IRequestRedrawEvent> { return this._onRequestRedraw.event; }
private _onRecoverContext = new EventEmitter<void>();
public get onRecoverContext(): IEvent<void> { return this._onRecoverContext.event; }
private _onContextLoss = new EventEmitter<void>();
public get onContextLoss(): IEvent<void> { return this._onContextLoss.event; }
constructor(
private _terminal: Terminal,
@@ -87,7 +87,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
throw new Error('WebGL2 not supported ' + this._gl);
}
this.register(addDisposableDomListener(this._canvas, 'webglcontextlost', (e) => { this._onContextLost(e); }));
this.register(addDisposableDomListener(this._canvas, 'webglcontextlost', (e) => { this._onContextLoss.fire(e); }));
this._core.screenElement!.appendChild(this._canvas);
@@ -100,11 +100,6 @@ export class WebglRenderer extends Disposable implements IRenderer {
this._isAttached = document.body.contains(this._core.screenElement!);
}
private _onContextLost(e: Event): void {
e.preventDefault();
this._onRecoverContext.fire();
}
public dispose(): void {
for (const l of this._renderLayers) {
l.dispose();