(url: string)
| 48 | private _cache: Record<string, Observable<string>> = {}; |
| 49 | |
| 50 | fetchDocument(url: string): Observable<string> { |
| 51 | if (this._cache[url]) { |
| 52 | return this._cache[url]; |
| 53 | } |
| 54 | |
| 55 | const stream = this._http.get(url, {responseType: 'text'}).pipe(shareReplay(1)); |
| 56 | return stream.pipe(tap(() => (this._cache[url] = stream))); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | @Component({ |