22 lines
499 B
TypeScript
22 lines
499 B
TypeScript
import { Injectable } from "@angular/core";
|
|
import { Observable, BehaviorSubject } from "rxjs";
|
|
import { DocumentData } from "../symbols/DocumentData";
|
|
|
|
@Injectable({
|
|
providedIn: "root"
|
|
})
|
|
export class CurrentDocumentService {
|
|
|
|
private documentSubject = new BehaviorSubject(null);
|
|
|
|
constructor() { }
|
|
|
|
public onDocumentChange(): Observable<DocumentData> {
|
|
return this.documentSubject.asObservable();
|
|
}
|
|
|
|
public setCurrentDocument(data: DocumentData) {
|
|
this.documentSubject.next(data);
|
|
}
|
|
}
|