tabby/app/src/terminal/recoveryProvider.ts

24 lines
672 B
TypeScript
Raw Normal View History

2017-03-24 22:29:54 +00:00
import { Injectable } from '@angular/core'
2017-03-25 17:12:43 +00:00
import { Tab, TabRecoveryProvider } from 'api'
2017-03-24 22:29:54 +00:00
import { TerminalTab } from './tab'
import { SessionsService } from './services/sessions'
@Injectable()
2017-03-25 17:12:43 +00:00
export class RecoveryProvider extends TabRecoveryProvider {
constructor (private sessions: SessionsService) {
super()
}
2017-03-24 22:29:54 +00:00
2017-03-25 20:00:16 +00:00
async recover (recoveryToken: any): Promise<Tab> {
2017-03-24 22:29:54 +00:00
if (recoveryToken.type == 'app:terminal') {
2017-03-25 20:00:16 +00:00
let session = await this.sessions.recover(recoveryToken.recoveryId)
if (!session) {
return null
}
2017-03-24 22:29:54 +00:00
return new TerminalTab(session)
}
return null
}
}