| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2e4a0d0 commit 7da2a44
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1412,17 +1412,14 @@ port2.postMessage(new Foo()); | |||
| 1412 | 1412 | // Prints: { c: 3 } | |
| 1413 | 1413 | ``` | |
| 1414 | 1414 | ||
| 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`: | ||
| 1417 | 1417 | ||
| 1418 | 1418 | ```js | |
| 1419 | 1419 | const { port1, port2 } = new MessageChannel(); | |
| 1420 | 1420 | ||
| 1421 | - port1.onmessage = ({ data }) => console.log(data); | ||
| 1422 | - | ||
| 1423 | 1421 | port2.postMessage(new URL('https://example.org')); | |
| 1424 | - | ||
| 1425 | - // Prints: { } | ||
| 1422 | + // Throws DataCloneError: Cannot clone object of unsupported type. | ||
| 1426 | 1423 | ``` | |
| 1427 | 1424 | ||
| 1428 | 1425 | ### `port.hasRef()` | |
| Back | FazBrowse Home | New Git URL |
0 commit comments