25 lines
2.8 KiB
JavaScript
25 lines
2.8 KiB
JavaScript
|
import { Injectable } from '@angular/core';
|
||
|
import { Subject } from 'rxjs';
|
||
|
import * as i0 from "@angular/core";
|
||
|
export class TerminalService {
|
||
|
commandSource = new Subject();
|
||
|
responseSource = new Subject();
|
||
|
commandHandler = this.commandSource.asObservable();
|
||
|
responseHandler = this.responseSource.asObservable();
|
||
|
sendCommand(command) {
|
||
|
if (command) {
|
||
|
this.commandSource.next(command);
|
||
|
}
|
||
|
}
|
||
|
sendResponse(response) {
|
||
|
if (response) {
|
||
|
this.responseSource.next(response);
|
||
|
}
|
||
|
}
|
||
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TerminalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
||
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TerminalService });
|
||
|
}
|
||
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TerminalService, decorators: [{
|
||
|
type: Injectable
|
||
|
}] });
|
||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVybWluYWxzZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FwcC9jb21wb25lbnRzL3Rlcm1pbmFsL3Rlcm1pbmFsc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQzNDLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxNQUFNLENBQUM7O0FBRy9CLE1BQU0sT0FBTyxlQUFlO0lBQ2hCLGFBQWEsR0FBRyxJQUFJLE9BQU8sRUFBVSxDQUFDO0lBQ3RDLGNBQWMsR0FBRyxJQUFJLE9B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