From 72d376d56f7c33282c1998286111f5cb319d82a0 Mon Sep 17 00:00:00 2001 From: Emil Bay Date: Fri, 26 Jun 2020 12:43:09 +0200 Subject: [PATCH] messagechannel check --- memory.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/memory.js b/memory.js index 662970b..4d8aa4f 100644 --- a/memory.js +++ b/memory.js @@ -1,5 +1,6 @@ /* eslint-disable camelcase */ -if (!window) var { MessageChannel } = require('worker' + '_threads') +var MessageChannel = global.MessageChannel +if (MessageChannel == null) ({ MessageChannel } = require('worker' + '_threads')) function sodium_malloc (n) { return new Uint8Array(n)