MCPcopy Create free account
hub / github.com/angular/components / fetchDocument

Method fetchDocument

docs/src/app/shared/doc-viewer/doc-viewer.ts:52–59  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

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({

Callers 1

_fetchDocumentMethod · 0.80

Calls 1

getMethod · 0.65

Tested by

no test coverage detected