Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. WorkerGlobalScope
  4. structuredClone()

WorkerGlobalScope: structuredClone() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2022.

Note: This feature is only available inWeb Workers.

ThestructuredClone() method of theWorkerGlobalScope interface creates adeep copy of a given value using thestructured clone algorithm.

The method also allowstransferable objects in the original value to betransferred 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.

Syntax

js
structuredClone(value)structuredClone(value, options)

Parameters

value

The object to be cloned.This can be anystructured-cloneable type.

optionsOptional

An object with the following properties:

transfer

An array oftransferable objects that will be moved rather than cloned to the returned object.

Return value

Adeep copy of the originalvalue.

Exceptions

DataCloneErrorDOMException

Thrown if any part of the input value is not serializable.

Description

SeeWindow.structuredClone() for details of this function.

Examples

SeeWindow.structuredClone() for examples.

Specifications

Specification
HTML
# dom-structuredclone

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp