Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Template.reporter.onRendered(function () {
const xterm = new Terminal({
cols: this.nColumns.get(),
rows: 40,
convertEol: true,
cursorBlink: true,
scrollback: 2048,
});
let processing = false;
this.resize = () => {
if (!processing) {
setTimeout(() => {
xterm.fit();
xterm.showCursor();
this.needsRedraw.changed();
processing = false;
}, 50);if (!this.connectionStatus) {
return;
}
this.connectSubscription = this.connectionStatus.subscribe((count: number) => {
this.isConnected = (count !== 0);
if (this.isConnected) {
this.xterm.focus();
this.isConnecting = false;
}
if (!this.isDestroying) {
this.changeDetector.detectChanges();
}
});
this.xterm = new Terminal({
cols: 80,
rows: 40
});
this.xterm.open(this.container.nativeElement, false);
this.xterm.on('data', this.onTermSendData);
this.xterm.on('resize', this.onTermResize);
this.reconnect();
}if (!this.connectionStatus) {
return;
}
this.connectSubscription = this.connectionStatus.subscribe((count: number) => {
this.isConnected = (count !== 0);
if (this.isConnected) {
this.xterm.focus();
this.isConnecting = false;
}
if (!this.isDestroying) {
this.changeDetector.detectChanges();
}
});
this.xterm = new Terminal({
cols: 80,
rows: 40
});
this.xterm.open(this.container.nativeElement, false);
this.xterm.on('data', this.onTermSendData);
this.xterm.on('resize', this.onTermResize);
this.reconnect();
}