worker: use fake MessageEvent for port.onmessage by addaleax · Pull Request #26082 · nodejs/node
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.)
added
c++
labels
Feb 13, 2019
addaleax
added
the
author ready
label
Feb 15, 2019
addaleax
deleted the
worker-onmessage-messageevent
branch
addaleax added a commit that referenced this pull request
Feb 15, 2019Instead 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: #26082 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
addaleax added a commit that referenced this pull request
Feb 16, 2019Instead 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: #26082 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
rvagg pushed a commit that referenced this pull request
Feb 28, 2019Instead 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: #26082 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
BridgeAR added a commit that referenced this pull request
Mar 5, 2019Notable Changes
* n-api:
* Implement date object (Jarrod Connolly)
#25917
* util:
* Add compact depth mode for `util.inspect()` (Ruben Bridgewater)
#26269
* worker:
* Improve integration with native addons (Anna Henningsen)
#26175
* MessagePort.prototype.onmessage takes arguments closer to the Web
specification now (Anna Henningsen)
#26082
Trott pushed a commit to Trott/io.js that referenced this pull request
Mar 6, 2019Notable Changes
* n-api:
* Implement date object (Jarrod Connolly)
nodejs#25917
* util:
* Add compact depth mode for `util.inspect()` (Ruben Bridgewater)
nodejs#26269
* worker:
* Improve integration with native addons (Anna Henningsen)
nodejs#26175
* MessagePort.prototype.onmessage takes arguments closer to the Web
specification now (Anna Henningsen)
nodejs#26082
This was referenced
Mar 22, 2019This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters