@@ -120,6 +120,9 @@ added: v10.5.0
120120An arbitrary JavaScript value that contains a clone of the data passed
121121to this thread’s ` Worker ` constructor.
122122
123+ The data is cloned as if using [ ` postMessage() ` ] [ `port.postMessage()` ] ,
124+ using the [ HTML structured clone algorithm] [ ] .
125+
123126``` js
124127const { Worker , isMainThread , workerData } = require (' worker_threads' );
125128
@@ -222,10 +225,16 @@ added: v10.5.0
222225
223226Sends a JavaScript value to the receiving side of this channel.
224227` value ` will be transferred in a way which is compatible with
225- the [ HTML structured clone algorithm] [ ] . In particular, it may contain circular
226- references and objects like typed arrays that the ` JSON ` API is not able
227- to stringify.
228+ the [ HTML structured clone algorithm] [ ] .
228229
230+ In particular, the significant differences to ` JSON ` are:
231+ - ` value ` may contain circular references.
232+ - ` value ` may contain instances of builtin JS types such as ` RegExp ` s,
233+ ` BigInt ` s, ` Map ` s, ` Set ` s, etc.
234+ - ` value ` may contained typed arrays, both using ` ArrayBuffer ` s
235+ and ` SharedArrayBuffer ` s. and
236+ - ` value ` may contain [ ` WebAssembly.Module ` ] [ ] instances.
237+ - ` value ` may not contain native (C++-backed) objects other than ` MessagePort ` s.
229238
230239``` js
231240const { MessageChannel } = require (' worker_threads' );
@@ -567,6 +576,7 @@ active handle in the event system. If the worker is already `unref()`ed calling
567576[ `MessagePort` ] : #worker_threads_class_messageport
568577[ `SharedArrayBuffer` ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
569578[ `Uint8Array` ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
579+ [ `WebAssembly.Module` ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module
570580[ `Worker` ] : #worker_threads_class_worker
571581[ `'close'` event ] : #worker_threads_event_close
572582[ `cluster` module ] : cluster.html
0 commit comments