Skip to content

Commit

Permalink
MessagePort.postMessage also support passing an options param (#2…
Browse files Browse the repository at this point in the history
…9282)

Update index.md
  • Loading branch information
skyclouds2001 authored Oct 2, 2023
1 parent 4186d51 commit 60265a8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions files/en-us/web/api/messageport/postmessage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ transfers ownership of objects to other browsing contexts.
## Syntax

```js-nolint
postMessage(message, transferList)
postMessage(message)
postMessage(message, options)
postMessage(message, transfer)
```

### Parameters

- `message`
- : The message you want to send through the channel. This can be of any basic data
type. Multiple data items can be sent as an array.
- `transferList` {{optional_inline}}
- : [Transferable objects](/en-US/docs/Web/API/Web_Workers_API/Transferable_objects) to be transferred — these objects have their
ownership transferred to the receiving browsing context, so are no longer usable by
the sending browsing context.
- : The message you want to send through the channel. This can be of any basic data type. Multiple data items can be sent as an array.
- `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.
- `transfer` {{optional_inline}}
- : 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

0 comments on commit 60265a8

Please sign in to comment.