MCPcopy Create free account
hub / github.com/UI5/webcomponents / fetchTextOnce

Function fetchTextOnce

packages/base/src/util/FetchHelper.ts:5–16  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

3const textPromises = new Map<string, Promise<string>>();
4
5const fetchTextOnce = async (url: string) => {
6 if (!fetchPromises.get(url)) {
7 fetchPromises.set(url, fetch(url));
8 }
9 const response = await fetchPromises.get(url);
10
11 if (response && !textPromises.get(url)) {
12 textPromises.set(url, response.text());
13 }
14
15 return textPromises.get(url);
16};
17
18const fetchJsonOnce = async (url: string) => {
19 if (!fetchPromises.get(url)) {

Callers

nothing calls this directly

Calls 3

getMethod · 0.80
fetchFunction · 0.50
textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…