Transferable Objects
Transferable objects (ArrayBuffer, MessagePort, ImageBitmap) transfer ownership when passed via postMessage; the sender loses access.
Purpose
To pass large buffers to Workers zero-copy, avoiding serialization copy overhead and improving performance.
Mechanism
postMessage(data, [transferables]): ownership of objects in the transferables array moves to the receiver; the sender original object becomes detached (length 0, inaccessible). The receiver obtains the original object.
Use cases
- Worker zero-copy transfer
- Large buffer transfer
- Performance optimization