- From: Kagami Sascha Rosylight <notifications@github.com>
- Date: Tue, 15 Jul 2025 03:24:34 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 15 July 2025 10:24:38 UTC
saschanaz left a comment (whatwg/dom#1389) Hmm, I was thinking more about addEventListener-ish "keep working until you get the abort signal" situation. Suppose something like: ```js while (!signal.aborted) { await write(serialize(data), { signal }) await flush(); sleep(10000) } ``` And then somewhere else you do: 1. Abort the file write repeat 2. Upload the file At step 2 you don't know whether the last write is flushed or not, because abort() doesn't wait for anything. (in this specific case you can probably call `flush()` again to make sure, though.) What would be nicer (while the API addition is arbitrary and probably not nice enough) ```js while (!signal.aborted) { signal.cleanup(() => flush()); await write(serialize(data), { signal }) sleep(10000) } // And then somewhere else: // makes sure everything is aborted await controller.abort() ``` -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1389#issuecomment-3073055289 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1389/3073055289@github.com>
Received on Tuesday, 15 July 2025 10:24:38 UTC