mirror of
https://github.com/eugeny/tabby
synced 2026-08-13 09:31:23 +00:00
43 lines
903 B
TypeScript
43 lines
903 B
TypeScript
import { Subject } from 'rxjs'
|
|
import { ViewRef } from '@angular/core'
|
|
|
|
export abstract class BaseTabComponent {
|
|
private static lastTabID = 0
|
|
id: number
|
|
title: string
|
|
customTitle: string
|
|
scrollable: boolean
|
|
hasActivity = false
|
|
focused$ = new Subject<void>()
|
|
blurred$ = new Subject<void>()
|
|
hasFocus = false
|
|
hostView: ViewRef
|
|
|
|
constructor () {
|
|
this.id = BaseTabComponent.lastTabID++
|
|
this.focused$.subscribe(() => {
|
|
this.hasFocus = true
|
|
})
|
|
this.blurred$.subscribe(() => {
|
|
this.hasFocus = false
|
|
})
|
|
}
|
|
|
|
displayActivity (): void {
|
|
this.hasActivity = true
|
|
}
|
|
|
|
getRecoveryToken (): any {
|
|
return null
|
|
}
|
|
|
|
async canClose (): Promise<boolean> {
|
|
return true
|
|
}
|
|
|
|
destroy (): void {
|
|
this.focused$.complete()
|
|
this.blurred$.complete()
|
|
}
|
|
}
|