import { Injectable } from '@angular/core'; import { Subject , Subscription , Observable } from 'rxjs'; import { CommunicationSubject } from '../interfaces/communication.subject'; @Injectable() export class HBORCommunicationService { public refresh = new Subject(); public delete = new Subject(); public rowLimit = new Subject(); public rowLimitRaw = 15; public errorOccured = new Subject(); // Observable boolean streams public refresh$ = this.refresh.asObservable(); public delete$ = this.delete.asObservable(); public rowLimit$ = this.rowLimit.asObservable(); public errorOccured$ = this.errorOccured.asObservable(); // Service message commands publishDataRefresh(state: boolean) { this.refresh.next(state); } publishDataDelete(state: CommunicationSubject) { this.delete.next(state); } publishDataRowLimit(state: number) { this.rowLimit.next(state); this.rowLimitRaw = state; } publishErrrorOccured(state: true) { this.errorOccured.next(state); } }