Re: [w3ctag/design-reviews] AbortSignal.timeout() (Issue #711)

I accept that having the factory method on AbortSignal makes the simple case where an author only wants to timeout a fetch easy, e.g.:

     fetch(url, { signal: AbortSignal.timeout(8000) });
     
However, the scenario where the author needs their own AbortController and wants a timeout is more complex, e.g.:

    const controller = AbortController();
    fetch(url, { signal: AbortSignal.any(controller.signal, AbortSignal.timeout(8000)) });
    
vs having a timeout parameter on the AbortController constructor:

    const controller = AbortController({ timeout: 8000 });
    fetch(url, { signal: controller.signal });

Why not have both?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/711#issuecomment-1180617661
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/issues/711/1180617661@github.com>

Received on Monday, 11 July 2022 16:27:29 UTC