Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client.postMessage also support passing an options param #29187

Merged
merged 9 commits into from
Oct 8, 2023
7 changes: 4 additions & 3 deletions files/en-us/web/api/client/postmessage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ message is received in the "`message`" event on

```js-nolint
postMessage(message)
postMessage(message, options)
postMessage(message, transferables)
```

### Parameters

- `message`
- : The message to send to the client. This can be any [structured-cloneable type](/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm).
- `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. The ownership of these objects is given to the destination side and they are no longer usable on the sending side.
- `transferables` {{optional_inline}}
- : A sequence of objects that are [transferred](/en-US/docs/Web/API/Web_Workers_API/Transferable_objects) with the message. The
ownership of these objects is given to the destination side and they are no longer
usable on the sending side.
- : An optional [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. The ownership of these objects is given to the destination side and they are no longer usable on the sending side.

### Return value

Expand Down