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

> We looked at this today, and had a question about the design of this API. Why is this a new factory method (especially on a non constructible class, AbortSignal) instead of a parameter in the AbortController constructor

The idea is that there is no web-developer-visible `AbortController` for this `AbortSignal`; the browser holds onto the ability to control the signal, instead of the web developer. (In particular, the browser uses that ability to signal after the timeout.)

> instead of a parameter in the AbortController constructor, that would also allow combining with regular signal functionality?

I'm not sure what you mean by this? In general combining works at the level of signals, not controllers.

> Also, we wondered if there are any plans for extending or cancelling the timeout.

This was proposed in https://github.com/whatwg/dom/issues/1039 but the use cases were rather esoteric. My current opinion is that it is not necessary to give such full control; if a developer wants that they can just use `setTimeout` + `AbortController` themselves. This is a simple factory method to make the 95% case easier, e.g. by not having the developer need to care about controllers, just getting a signal in a single line of code.

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

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

Received on Tuesday, 8 February 2022 20:50:17 UTC