GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: fix URL postMessage example in worker_threads · nodejs/node@7da2a44

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • worker_threads.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/worker_threads.md‎

Copy file name to clipboardExpand all lines: doc/api/worker_threads.md
+3-6Lines changed: 3 additions & 6 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1412,17 +1412,14 @@ port2.postMessage(new Foo());
14121412
// Prints: { c: 3 }
14131413
```
14141414
1415-
This limitation extends to many built-in objects, such as the global `URL`
1416-
object:
1415+
Some built-in objects cannot be cloned at all. For example, posting a
1416+
`URL` object throws a `DataCloneError`:
14171417
14181418
```js
14191419
const { port1, port2 } = new MessageChannel();
14201420

1421-
port1.onmessage = ({ data }) => console.log(data);
1422-
14231421
port2.postMessage(new URL('https://example.org'));
1424-
1425-
// Prints: { }
1422+
// Throws DataCloneError: Cannot clone object of unsupported type.
14261423
```
14271424
14281425
### `port.hasRef()`

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.