2018-02-20 08:39:59 +00:00
|
|
|
import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
2018-02-20 15:54:41 +00:00
|
|
|
import { TerminadoService } from '../services/terminado.service';
|
2018-01-17 16:25:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-terminal',
|
|
|
|
templateUrl: './terminal.component.html',
|
|
|
|
styleUrls: ['./terminal.component.scss']
|
|
|
|
})
|
|
|
|
export class TerminalComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
|
@ViewChild('xterm') target: ElementRef;
|
|
|
|
|
|
|
|
constructor(private terminadoService: TerminadoService) { }
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
}
|
|
|
|
|
|
|
|
ngAfterViewInit() {
|
|
|
|
this.terminadoService.attach(this.target.nativeElement as HTMLElement);
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
|
|
|
this.terminadoService.detach();
|
|
|
|
}
|
|
|
|
|
|
|
|
fit() {
|
|
|
|
this.terminadoService.fit();
|
|
|
|
}
|
|
|
|
}
|