- From: Jake Archibald <notifications@github.com>
- Date: Fri, 05 Feb 2021 04:17:30 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 5 February 2021 12:17:42 UTC
I gave it a spin on squoosh.app, which uses abort signals quite a bit https://github.com/GoogleChromeLabs/squoosh/pull/954/files - it helped in one place!
The other helpers I needed were [`assetNotAborted`](https://github.com/whatwg/dom/issues/927), and a way to make a promise appear to be abortable. The implementation of the latter becomes:
```js
/**
* Take a signal and promise, and returns a promise that rejects with an AbortError if the abort is
* signalled, otherwise resolves with the promise.
*/
export async function abortable(signal, promise) {
return abortableTask(signal, () => promise);
}
```
…which is kinda nice.
`abortableTask` is the wrong name though, since it clashes with tasks in HTML.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/946#issuecomment-773998489
Received on Friday, 5 February 2021 12:17:42 UTC