From 9cc36c338a51ee47665abb59829e0b7ca3ae44b4 Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Thu, 21 Sep 2023 16:51:41 +0800 Subject: [PATCH] DedicatedWorkerGlobalScope.postMessage also support passing an options param (#29228) --- .../dedicatedworkerglobalscope/postmessage/index.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/files/en-us/web/api/dedicatedworkerglobalscope/postmessage/index.md b/files/en-us/web/api/dedicatedworkerglobalscope/postmessage/index.md index 6691b5371f56f57..cfbd0ced0efa6df 100644 --- a/files/en-us/web/api/dedicatedworkerglobalscope/postmessage/index.md +++ b/files/en-us/web/api/dedicatedworkerglobalscope/postmessage/index.md @@ -22,15 +22,23 @@ The main scope that spawned the worker can send back information to the thread t ## Syntax ```js-nolint -postMessage(message, transferList) +postMessage(message) +postMessage(options) +postMessage(message, transfer) ``` ### Parameters - `message` + - : The object to deliver to the main thread; this will be in the data field in the event delivered to the {{domxref("Worker.message_event")}}. This may be any value or JavaScript object handled by the [structured clone](/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) algorithm, which includes cyclical references. -- `transferList` {{optional_inline}} + +- `options` {{optional_inline}} + + - : An optional object containing a `transfer` field with an [array](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of [transferable objects](/en-US/docs/Web/API/Web_Workers_API/Transferable_objects) to transfer ownership of. If the ownership of an object is transferred, it becomes unusable in the context it was sent from and it becomes available only to the main thread it was sent to. + +- `transfer` {{optional_inline}} - : An optional ordered [array](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of [transferable objects](/en-US/docs/Web/API/Web_Workers_API/Transferable_objects) to transfer ownership of. If the ownership of an object is transferred, it becomes unusable in the context it was sent from and it becomes available only to the main thread it was sent to.