Closed KooIaIa closed 1 month ago
CORS is not an issue - COOP/COEP are required for SharedArrayBuffer.
No, Transferable would not help here because the SAB's primary role is not the transfer of bytes but as a barrier for use with the Atomics API, which is needed in order to make the OPFS async APIs appear to sqlite as if they are synchronous. In the main OPFS VFS we cannot currently get around that because we cannot intermix async code (OPFS) in the same thread as the synchronous sqlite API.
The opfs-sahpool VFS works around that problem a different way, with different tradeoffs. It does not require SAB/COOP/COEP but also lacks any library-level support for multi-tab concurrency.
Please pardon brevity and lack of reference links - typing on a mobile device.
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects
Could Transferable Object be used instead SharedArrayBuffers as another option to avoid needing CORS?