Concepts
Structured clone of shared memory
Clones the wrapper while retaining access to shared underlying bytes; not a transfer.
Formal Syntax & Structure
javascript syntaxjavascript
structuredClone(sharedBuffer)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| sharedBuffer | SharedArrayBuffer | Shared buffer to clone. |
Return Value
SharedArrayBuffer
Clones the wrapper while retaining access to shared underlying bytes; not a transfer.
Working Example
Example Snippetjavascript
(async () => {const a=new SharedArrayBuffer(4),b=structuredClone(a);new Int32Array(b)[0]=11;console.log(a===b,new Int32Array(a)[0]);})()