| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/structuredClone | [Back] [Original] |
Get to know MDN better
This feature is well established and works across many devices and browser versions. Its been available across browsers since March 2022.
Note: This feature is only available in Web Workers.
The structuredClone() method of the WorkerGlobalScope interface creates a deep copy of a given value using the structured clone algorithm.
The method also allows transferable objects in the original value to be transferred rather than cloned to the new object. Transferred objects are detached from the original object and attached to the new object; they are no longer accessible in the original object.
structuredClone(value)
structuredClone(value, options)
valueThe object to be cloned. This can be any structured-cloneable type.
options OptionalAn object with the following properties:
transferAn array of transferable objects that will be moved rather than cloned to the returned object.
A deep copy of the original value.
DataCloneError DOMExceptionThrown if any part of the input value is not serializable.
See Window.structuredClone() for details of this function.
See Window.structuredClone() for examples.
| Specification |
|---|
| HTML # dom-structuredclone |
structuredClone is available in core-jsThis page was last modified on Sep 26, 2024 by MDN contributors.
WorkerGlobalScopeYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |