isSharedArrayBuffer
Checks if a value is a SharedArrayBuffer instance.
SharedArrayBuffer enables shared memory between the main thread and worker
threads. In browsers without COOP/COEP headers, SharedArrayBuffer may be
unavailable; this function returns false in that case.
Available since v2.0.3
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to check |
Returns
Section titled “Returns”value is SharedArrayBuffer — true if value is a SharedArrayBuffer
Examples
Section titled “Examples”Distinguish SharedArrayBuffer from ArrayBuffer
Section titled “Distinguish SharedArrayBuffer from ArrayBuffer”Returns true only for SharedArrayBuffer instances, not plain ArrayBuffers.
Safe shared memory check before worker communication
Section titled “Safe shared memory check before worker communication”Use as a guard to ensure a buffer can be transferred to a Worker.
