Unverified Commit 5adda2c4 authored by Anna Henningsen's avatar Anna Henningsen
Browse files

worker: use fake MessageEvent for port.onmessage

Instead of passing the payload for Workers directly to `.onmessage`,
perform something more similar to what the browser API provides,
namely create an event object with a `.data` property.

This does not make `MessagePort` implement the `EventTarget` API, nor
does it implement the full `MessageEvent` API, but it would make
such extensions non-breaking changes if we desire them at
some point in the future.

(This would be a breaking change if Workers were not experimental.
Currently, this method is also undocumented and only exists with
the idea of enabling some degree of Web compatibility.)

PR-URL: https://github.com/nodejs/node/pull/26082


Reviewed-By: default avatarGus Caplan <me@gus.host>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarDenys Otrishko <shishugi@gmail.com>
parent a02e3e2d
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment