dom icon indicating copy to clipboard operation
dom copied to clipboard

Is it intentional to not expose AbortSignal to Worklets?

Open saschanaz opened this issue 4 years ago • 5 comments

A worklet has EventTarget#addEventListener but it cannot use AbortSignal to batch-remove them. Is this intentional?

saschanaz avatar Dec 25 '20 20:12 saschanaz

I guess we should add this to AudioWorklet as well then.

cc @padenot

annevk avatar Jan 04 '21 06:01 annevk

We probably can use this in a few places indeed.

@hoch, I'm thinking about OfflineAudioContext rendering cancellation, decodeAudioData, etc. Unclear for AudioWorklet, maybe it can be useful.

padenot avatar Jan 04 '21 14:01 padenot

Interesting. How one would associate an AbortController with OfflineAudioContext.startRendering() and BaseAudioContext.decodeAudioData()?

Like @padenot mentioned, I am also not sure what this means to non-main thread Worklets.

hoch avatar Jan 05 '21 20:01 hoch

I don't see Paul mentioning that? In any event, given that we expose events in audio worklets, it seems we should expose this as otherwise addEventListener() is less functional in audio worklets and that would be confusing.

(If you want other APIs to adopt this as well, typically you would make them accept a dictionary with a signal member, as addEventListener() and fetch() do, for instance.)

annevk avatar Jan 06 '21 07:01 annevk

I was simply agreeing to the comment "Unclear for AudioWorklet".

Thanks for the explanation, @annevk!

hoch avatar Jan 06 '21 17:01 hoch