Allow renderer to be swapped in and out at runtime

Fixes #1589
This commit is contained in:
Daniel Imms
2018-07-29 13:50:45 -07:00
parent 6691f80906
commit 5aaf9ef11b
7 changed files with 62 additions and 12 deletions
+9
View File
@@ -81,6 +81,15 @@ export class DomRenderer extends EventEmitter implements IRenderer {
this._terminal.screenElement.appendChild(this._selectionContainer);
}
public dispose(): void {
this._terminal.element.classList.remove(TERMINAL_CLASS_PREFIX + this._terminalClass);
this._terminal.screenElement.removeChild(this._rowContainer);
this._terminal.screenElement.removeChild(this._selectionContainer);
this._terminal.screenElement.removeChild(this._themeStyleElement);
this._terminal.screenElement.removeChild(this._dimensionsStyleElement);
super.dispose();
}
private _updateDimensions(): void {
this.dimensions.scaledCharWidth = this._terminal.charMeasure.width * window.devicePixelRatio;
this.dimensions.scaledCharHeight = this._terminal.charMeasure.height * window.devicePixelRatio;