diff --git a/terminus-serial/src/components/serialTab.component.ts b/terminus-serial/src/components/serialTab.component.ts index bdd4e635..4bfd0b2a 100644 --- a/terminus-serial/src/components/serialTab.component.ts +++ b/terminus-serial/src/components/serialTab.component.ts @@ -92,18 +92,18 @@ export class SerialTabComponent extends BaseTerminalTabComponent { } protected attachSessionHandlers () { - this.attachSessionHandler(this.session!.serviceMessage$.subscribe(msg => { + this.attachSessionHandler(this.session!.serviceMessage$, msg => { this.write(`\r\n${colors.black.bgWhite(' Serial ')} ${msg}\r\n`) this.session?.resize(this.size.columns, this.size.rows) - })) - this.attachSessionHandler(this.session!.destroyed$.subscribe(() => { + }) + this.attachSessionHandler(this.session!.destroyed$, () => { this.write('Press any key to reconnect\r\n') this.input$.pipe(first()).subscribe(() => { if (!this.session?.open) { this.reconnect() } }) - })) + }) super.attachSessionHandlers() } diff --git a/terminus-settings/src/components/settingsTab.component.ts b/terminus-settings/src/components/settingsTab.component.ts index c5238aeb..532ea380 100644 --- a/terminus-settings/src/components/settingsTab.component.ts +++ b/terminus-settings/src/components/settingsTab.component.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import * as yaml from 'js-yaml' import { debounce } from 'utils-decorators/dist/cjs' -import { Subscription } from 'rxjs' import { Component, Inject, Input, HostBinding, NgZone } from '@angular/core' import { ElectronService, @@ -33,7 +32,6 @@ export class SettingsTabComponent extends BaseTabComponent { checkingForUpdate = false updateAvailable = false @HostBinding('class.pad-window-controls') padWindowControls = false - private configSubscription: Subscription constructor ( public config: ConfigService, @@ -58,7 +56,7 @@ export class SettingsTabComponent extends BaseTabComponent { && config.store.appearance.tabsLocation !== 'top' } - this.configSubscription = this.subscribeUntilDestroyed(config.changed$, onConfigChange) + this.subscribeUntilDestroyed(config.changed$, onConfigChange) onConfigChange() } @@ -76,7 +74,6 @@ export class SettingsTabComponent extends BaseTabComponent { } ngOnDestroy () { - this.configSubscription.unsubscribe() this.config.save() } diff --git a/terminus-ssh/src/components/sshTab.component.ts b/terminus-ssh/src/components/sshTab.component.ts index 1424a4a6..5f016090 100644 --- a/terminus-ssh/src/components/sshTab.component.ts +++ b/terminus-ssh/src/components/sshTab.component.ts @@ -92,13 +92,11 @@ export class SSHTabComponent extends BaseTerminalTabComponent { await this.setupOneSession(jumpSession) - this.attachSessionHandler( - jumpSession.destroyed$.subscribe(() => { - if (session.open) { - session.destroy() - } - }) - ) + this.attachSessionHandler(jumpSession.destroyed$, () => { + if (session.open) { + session.destroy() + } + }) session.jumpStream = await new Promise((resolve, reject) => jumpSession.ssh.forwardOut( '127.0.0.1', 0, session.connection.host, session.connection.port ?? 22, @@ -122,12 +120,12 @@ export class SSHTabComponent extends BaseTerminalTabComponent { this.startSpinner() - this.attachSessionHandler(session.serviceMessage$.subscribe(msg => { + this.attachSessionHandler(session.serviceMessage$, msg => { this.pauseSpinner(() => { this.write(`\r${colors.black.bgWhite(' SSH ')} ${msg}\r\n`) session.resize(this.size.columns, this.size.rows) }) - })) + }) try { await this.ssh.connectSession(session) @@ -141,7 +139,7 @@ export class SSHTabComponent extends BaseTerminalTabComponent { protected attachSessionHandlers (): void { const session = this.session! - this.attachSessionHandler(session.destroyed$.subscribe(() => { + this.attachSessionHandler(session.destroyed$, () => { if ( // Ctrl-D this.recentInputs.charCodeAt(this.recentInputs.length - 1) === 4 || @@ -162,7 +160,7 @@ export class SSHTabComponent extends BaseTerminalTabComponent { }) } } - })) + }) super.attachSessionHandlers() }