Re: [whatwg/fetch] Adds "audioworklet" and "paintworklet" as destinations. (#527)

I didn't fully understand how worklets worked. I think I'm closer now 😄.

* A worklet instance contains zero globals.
* When `addModule` is called, some globals are created, and the module is imported in each global.
* When `addModule` is called again, the module is imported in each global.
* The browser may at any point, increase the number of globals for a given worklet, or decrease them to a minimum of one.
* Only audio worklets have some kind of postMessage, but it isn't to the worklet global. A `AudioWorkletNode` instance gets linked to a particular `AudioWorkletProcessor` in a particular worklet global, and they can post messages between them.

This changing of globals will be observable to developers through global state, but like service workers the recommendation is "don't do that" (although like service workers developers will probably do that).

If we expose these things to the clients API, there isn't a lot you'll be able to do with them. I'm not sure it's useful exposing them there.

It feels like `addModule` is a subresource fetch for an already existing global, like loading scripts in an `about:blank` iframe. The opaque origin thing is a shame though, as it means these can't work offline.

-- 
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/fetch/pull/527#issuecomment-335872711

Received on Wednesday, 11 October 2017 16:45:13 UTC