@@ -1401,6 +1401,10 @@ Inside a worker, \[`worker_threads.parentPort`]\[] is the port behind
14011401` self.postMessage() ` and the worker's ` message ` events, ` isMainThread ` is
14021402` false ` , and ` workerData ` is ` undefined ` .
14031403
1404+ Web Workers, like ` node:worker_threads ` workers, keep the event loop alive by
1405+ default. In Node.js, Web Workers implement the [ Refable protocol] [ ] , and can be
1406+ ref'd and unref'd using ` process.ref(worker) ` and ` process.unref(worker) ` .
1407+
14041408As a rule of thumb, use [ ` node:worker_threads ` ] [ ] directly when a program
14051409needs ` workerData ` , a custom ` env ` or ` execArgv ` , resource limits, stdio
14061410redirection, the ` 'online' ` and ` 'exit' ` events, or ` worker.threadId ` ;
@@ -1457,6 +1461,7 @@ A browser-compatible implementation of [`WritableStreamDefaultWriter`][].
14571461[ HTML Standard ] : https://html.spec.whatwg.org/multipage/workers.html
14581462[ Navigator API ] : https://html.spec.whatwg.org/multipage/system-state.html#the-navigator-object
14591463[ RFC 5646 ] : https://www.rfc-editor.org/rfc/rfc5646.txt
1464+ [ Refable protocol ] : process.md#processrefmayberefable
14601465[ Web Crypto API ] : webcrypto.md
14611466[ `--experimental-eventsource` ] : cli.md#--experimental-eventsource
14621467[ `--experimental-web-worker` ] : cli.md#--experimental-web-worker
0 commit comments