mirror of
https://github.com/Eugeny/tabby.git
synced 2025-09-09 01:51:53 +00:00
plugged memory leaks
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { Component, Input } from '@angular/core'
|
||||
import { trigger, transition, style, animate } from '@angular/animations'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { HotkeysService } from 'terminus-core'
|
||||
import { HotkeysService, BaseComponent } from 'terminus-core'
|
||||
|
||||
const INPUT_TIMEOUT = 1000
|
||||
|
||||
@@ -36,11 +35,10 @@ const INPUT_TIMEOUT = 1000
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class HotkeyInputModalComponent {
|
||||
export class HotkeyInputModalComponent extends BaseComponent {
|
||||
@Input() value: string[] = []
|
||||
@Input() timeoutProgress = 0
|
||||
|
||||
private keySubscription: Subscription
|
||||
private lastKeyEvent: number|null = null
|
||||
private keyTimeoutInterval: number|null = null
|
||||
|
||||
@@ -48,8 +46,9 @@ export class HotkeyInputModalComponent {
|
||||
private modalInstance: NgbActiveModal,
|
||||
public hotkeys: HotkeysService,
|
||||
) {
|
||||
super()
|
||||
this.hotkeys.clearCurrentKeystrokes()
|
||||
this.keySubscription = hotkeys.key.subscribe((event) => {
|
||||
this.subscribeUntilDestroyed(hotkeys.key, (event) => {
|
||||
this.lastKeyEvent = performance.now()
|
||||
this.value = this.hotkeys.getCurrentKeystrokes()
|
||||
event.preventDefault()
|
||||
@@ -75,10 +74,10 @@ export class HotkeyInputModalComponent {
|
||||
}
|
||||
|
||||
ngOnDestroy (): void {
|
||||
this.keySubscription.unsubscribe()
|
||||
this.hotkeys.clearCurrentKeystrokes()
|
||||
this.hotkeys.enable()
|
||||
clearInterval(this.keyTimeoutInterval!)
|
||||
super.ngOnDestroy()
|
||||
}
|
||||
|
||||
close (): void {
|
||||
|
@@ -58,7 +58,7 @@ export class SettingsTabComponent extends BaseTabComponent {
|
||||
&& config.store.appearance.tabsLocation !== 'top'
|
||||
}
|
||||
|
||||
this.configSubscription = config.changed$.subscribe(onConfigChange)
|
||||
this.configSubscription = this.subscribeUntilDestroyed(config.changed$, onConfigChange)
|
||||
onConfigChange()
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,7 @@ import {
|
||||
Platform,
|
||||
isWindowsBuild,
|
||||
WIN_BUILD_FLUENT_BG_SUPPORTED,
|
||||
BaseComponent,
|
||||
} from 'terminus-core'
|
||||
|
||||
|
||||
@@ -17,7 +18,7 @@ import {
|
||||
selector: 'window-settings-tab',
|
||||
template: require('./windowSettingsTab.component.pug'),
|
||||
})
|
||||
export class WindowSettingsTabComponent {
|
||||
export class WindowSettingsTabComponent extends BaseComponent {
|
||||
screens: any[]
|
||||
Platform = Platform
|
||||
isFluentVibrancySupported = false
|
||||
@@ -29,10 +30,11 @@ export class WindowSettingsTabComponent {
|
||||
public zone: NgZone,
|
||||
@Inject(Theme) public themes: Theme[],
|
||||
) {
|
||||
super()
|
||||
this.screens = this.docking.getScreens()
|
||||
this.themes = config.enabledServices(this.themes)
|
||||
|
||||
hostApp.displaysChanged$.subscribe(() => {
|
||||
this.subscribeUntilDestroyed(hostApp.displaysChanged$, () => {
|
||||
this.zone.run(() => this.screens = this.docking.getScreens())
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user