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

Method fetchDocument

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

Source from the content-addressed store, hash-verified

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

Callers 1

_fetchDocumentMethod · 0.80

Calls 1

getMethod · 0.65

Tested by

no test coverage detected