Files
tabby/terminus-core/src/components/baseTab.component.ts
T
2017-07-24 14:48:16 +02:00

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()
}
}