11:23
<nicolo-ribaudo>

Monkey-patching for postMessage the way it's used as a scheduler would be something like this:

class MessageChannel extends globalThis.MessageChannel {
  constructor(...args) {
    super(...args);
    this.port1.__channel = this;
    this.port2.__channel = this;
    patch(this.port1);
    patch(this.port2);
  }
}

where patch wraps onmessage/addEventListener to get a registration-time snapshot, or as an alternative to store the .postMessage-time snapshot on this.__channel and run the event callback in it.

11:23
<nicolo-ribaudo>
(I think that this is bad code, but it's possible)
11:24
<nicolo-ribaudo>
And if the code patching is the same as the code needing the patch, it can just call .wrap instead (e.g. for React)
12:09
<Andreu Botella>
for MessageChannel, yes, but there's postMessage on window as well
12:16
<Michal Mocny>
Hey folks-- great presentation today. Thanks for the invite.
12:17
<Andreu Botella>
thank you for attending and providing your use cases!
12:17
<Michal Mocny>
Well I didn't provide use cases today but I was prepared to :P Seems we didn't need more support in the room, though
12:18
<Andreu Botella>
right 😅
12:18
<Andreu Botella>
I'm not too cogent after these long discussions
14:54
<Steve Hicks>
I'm not sure this does work - if you want to get dispatch-time snapshotting, you need to mutate the message to refer to the right snapshot, but AIUI you can't know whether one of the ports has been transferred to another agent - if so, then the patching won't work and the mutation is wrong.