Skip to content
101 changes: 38 additions & 63 deletions api/Worker.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,15 @@
"ie": {
"version_added": "10"
},
"nodejs": [
{
"version_added": "12.17.0",
"partial_implementation": true,
"notes": [
"Is a Node <code>EventEmitter</code> instead of DOM <code>EventTarget</code>.",
"Worker script environment expects CommonJS modules or ECMAScript modules.",
"Must be imported from the <code>worker_threads</code> module."
]
},
{
"version_added": "11.7.0",
"partial_implementation": true,
"notes": [
"Is a Node <code>EventEmitter</code> instead of DOM <code>EventTarget</code>.",
"Worker script environment expects CommonJS modules.",
"Must be imported from the <code>worker_threads</code> module."
]
}
],
"nodejs": {
"version_added": "11.7.0",
"partial_implementation": true,
"notes": [
"Inherit from a Node <code>EventEmitter</code> instead of DOM <code>EventTarget</code>.",
"Also supports CommonJS modules, enabled for files ending with <code>.cjs</code> and for files ending with <code>.js</code> when the nearest parent <code>package.json</code> file contains a top-level field <code>\"type\"</code> with a value not of <code>\"commonjs\"</code>.",
"Available as a part of the <code>worker_threads</code> module."
]
},
Comment on lines +25 to +33
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Verified that worker_threads.Worker exists in v12.0.0, which seems to be the gist of this change.

"oculus": "mirror",
"opera": {
"version_added": "10.6"
Expand Down Expand Up @@ -88,18 +77,11 @@
"ie": {
"version_added": "10"
},
"nodejs": [
{
"version_added": "12.17.0",
"partial_implementation": true,
"notes": "Takes entirely different options."
},
{
"version_added": "11.7.0",
"partial_implementation": true,
"notes": "Takes entirely different options."
}
],
"nodejs": {
"version_added": "11.7.0",
"partial_implementation": true,
"notes": "Takes entirely different options parameters."
},
Comment on lines +80 to +84
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Makes sense based on parent change.

"oculus": "mirror",
"opera": {
"version_added": "10.6"
Expand Down Expand Up @@ -318,6 +300,9 @@
"ie": {
"version_added": false
},
"nodejs": {
"version_added": "11.7.0"
},
Comment on lines +303 to +305
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Verified locally with this worker.js, created via new worker_threads.Worker('./worker.js'):

const { Worker } = require('worker_threads');
const { writeFileSync } = require('fs');

writeFileSync('./worker.log', Worker, 'utf-8');

"oculus": "mirror",
"opera": "mirror",
"opera_android": "mirror",
Expand Down Expand Up @@ -359,7 +344,7 @@
"version_added": "10"
},
"nodejs": {
"version_added": false
"version_added": "11.7.0"
},
"oculus": "mirror",
"opera": {
Expand Down Expand Up @@ -408,18 +393,9 @@
"ie": {
"version_added": "10"
},
"nodejs": [
{
"version_added": "12.17.0",
"partial_implementation": true,
"notes": "Supports the event, but only via Node <code>EventEmitter</code>."
Comment thread
skyclouds2001 marked this conversation as resolved.
Outdated
},
{
"version_added": "11.7.0",
"partial_implementation": true,
"notes": "Supports the event, but only via Node <code>EventEmitter</code>."
}
],
"nodejs": {
"version_added": "11.7.0"
},
Comment on lines +401 to +405
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Makes sense based on parent change.

"oculus": "mirror",
"opera": {
"version_added": "10.6"
Expand Down Expand Up @@ -468,9 +444,15 @@
"ie": {
"version_added": false
},
"nodejs": {
"version_added": false
},
"nodejs": [
{
"version_added": "14.5.0"
},
{
"version_added": "12.19.0",
"version_removed": "13.0.0"
}
],
Comment on lines +454 to +466
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Verified via the referenced PR.

"oculus": "mirror",
"opera": "mirror",
"opera_android": "mirror",
Expand Down Expand Up @@ -543,18 +525,11 @@
"version_added": "10",
"notes": "Internet Explorer does not support <code>Transferable</code> objects."
},
"nodejs": [
{
"version_added": "12.17.0",
"partial_implementation": true,
"notes": "Supports <code>transferList</code> argument for transferring <code>ArrayBuffer</code> and <code>MessagePort</code> objects"
},
{
"version_added": "11.7.0",
"partial_implementation": true,
"notes": "Supports <code>transferList</code> argument for transferring <code>ArrayBuffer</code> and <code>MessagePort</code> objects"
}
],
"nodejs": {
"version_added": "11.7.0",
"partial_implementation": true,
"notes": "Only support <code>transferList</code> parameter as an optional array of objects."
},
Comment on lines +541 to +548
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Makes sense based on parent change.

New note:

The options parameter is not supported; the second parameter may only be an array of objects to transfer.

"oculus": "mirror",
"opera": {
"version_added": "10.6"
Expand Down Expand Up @@ -603,14 +578,14 @@
},
"nodejs": [
{
"version_added": "12.17.0",
"version_added": "12.5.0",
"partial_implementation": true,
"notes": "Also takes an optional callback to be executed when the worker has terminated."
"notes": "Returns a <code>Promise</code> instead. Taking an optional callback parameter is deprecated."
Comment thread
skyclouds2001 marked this conversation as resolved.
Outdated
},
{
"version_added": "11.7.0",
"partial_implementation": true,
"notes": "Also takes an optional callback to be executed when the worker has terminated."
"notes": "Support taking an optional callback parameter to be executed when the worker has terminated."
Comment thread
skyclouds2001 marked this conversation as resolved.
Outdated
}
],
"oculus": "mirror",
Expand Down