Skip to main content

fetchWithTimeout

Callable

  • fetchWithTimeout(input: URL | RequestInfo, init?: RequestInit, timeout?: number): any

  • Performs a fetch operation with a timeout.

    @example
    // Perform a fetch request with a timeout of 3000ms
    fetchWithTimeout("https://api.example.com/data", { method: "GET" }, 3000)
    .then(response => {
    console.log("Success:", response);
    })
    .catch(error => {
    console.error("Error:", error);
    });