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