MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / fetchWithTimeout

Function fetchWithTimeout

packages/react-native-inspector/src/index.ts:1254–1275  ·  view source on GitHub ↗
(
  url: string,
  init: RequestInit,
  timeoutMs: number,
)

Source from the content-addressed store, hash-verified

1252}
1253
1254function fetchWithTimeout(
1255 url: string,
1256 init: RequestInit,
1257 timeoutMs: number,
1258): Promise<Response> {
1259 return new Promise((resolve, reject) => {
1260 const timeoutId = setTimeout(
1261 () => reject(new Error("Symbolication timed out.")),
1262 timeoutMs,
1263 );
1264 fetch(url, init).then(
1265 (response) => {
1266 clearTimeout(timeoutId);
1267 resolve(response);
1268 },
1269 (error) => {
1270 clearTimeout(timeoutId);
1271 reject(error);
1272 },
1273 );
1274 });
1275}
1276
1277function bestSourceLocation(
1278 locations: Array<JSONObject | null | undefined>,

Callers 1

Calls 1

fetchFunction · 0.85

Tested by

no test coverage detected