MCPcopy Create free account
hub / github.com/VirtualHotBar/NetMount / cancellableFetch

Function cancellableFetch

src/utils/request.ts:371–385  ·  view source on GitHub ↗
(
  url: string,
  options: RequestInit = {}
)

Source from the content-addressed store, hash-verified

369 * @returns { abort, promise } - abort 函数和 promise
370 */
371export function cancellableFetch<T>(
372 url: string,
373 options: RequestInit = {}
374): { abort: () => void; promise: Promise<T> } {
375 const controller = new AbortController()
376 const promise = fetchWithTimeout<T>(url, {
377 ...options,
378 signal: controller.signal,
379 })
380
381 return {
382 abort: () => controller.abort(),
383 promise,
384 }
385}
386
387/**
388 * 并发请求控制器

Callers

nothing calls this directly

Calls 1

fetchWithTimeoutFunction · 0.85

Tested by

no test coverage detected