From bd017d7cc41142a581abb8483dff3daf1197053f Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Sun, 17 Mar 2024 21:16:26 -0600 Subject: [PATCH] Don't use SharedArrayBuffer if it is not there, #278 --- write.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/write.js b/write.js index 707b6e01d..eb8f6bd25 100644 --- a/write.js +++ b/write.js @@ -26,7 +26,10 @@ const PROMISE_SUCCESS = Promise.resolve(true); export const ABORT = 4.452694326329068e-106; // random/unguessable numbers, which work across module/versions and native export const IF_EXISTS = 3.542694326329068e-103; const CALLBACK_THREW = {}; -const LocalSharedArrayBuffer = typeof Deno != 'undefined' ? ArrayBuffer : SharedArrayBuffer; // Deno can't handle SharedArrayBuffer as an FFI argument due to https://github.com/denoland/deno/issues/12678 +const LocalSharedArrayBuffer = typeof Deno != 'undefined' || // Deno can't handle SharedArrayBuffer as an FFI +// argument due to https://github.com/denoland/deno/issues/12678 +typeof SharedArrayBuffer == 'undefined' ? // Sometimes electron doesn't have a SharedArrayBuffer + ArrayBuffer : SharedArrayBuffer; const ByteArray = typeof Buffer != 'undefined' ? function(buffer) { return Buffer.from(buffer) } : Uint8Array; const queueTask = typeof setImmediate != 'undefined' ? setImmediate : setTimeout; // TODO: Or queueMicrotask? //let debugLog = []