From 87ff2a56bdc94d2a08c37fd5e5870c2030fc5545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Isager=20Dalsgar=C3=B0?= Date: Tue, 2 Nov 2021 16:36:15 +0100 Subject: [PATCH] Use `globalThis` instead of `global` (#61) * Use `globalThis` instead of `global` * Update `standard` --- .gitignore | 1 + memory.js | 2 +- package.json | 2 +- randombytes.js | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 3c3629e..d5f19d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +package-lock.json diff --git a/memory.js b/memory.js index d4e16c2..34ec562 100644 --- a/memory.js +++ b/memory.js @@ -17,7 +17,7 @@ var sink function loadSink () { if (sink) return sink - var MessageChannel = global.MessageChannel + var MessageChannel = globalThis.MessageChannel if (MessageChannel == null) ({ MessageChannel } = require('worker' + '_threads')) sink = new MessageChannel() return sink diff --git a/package.json b/package.json index a760f99..1f15bd5 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "devDependencies": { "browserify": "^16.5.1", "sodium-test": "^0.10.0", - "standard": "^14.3.4", + "standard": "^15.0.1", "tape-run": "^7.0.0" }, "standard": { diff --git a/randombytes.js b/randombytes.js index f0060c0..5d6f442 100644 --- a/randombytes.js +++ b/randombytes.js @@ -2,7 +2,7 @@ var assert = require('nanoassert') var randombytes = (function () { var QUOTA = 65536 // limit for QuotaExceededException - var crypto = global.crypto || global.msCrypto + var crypto = globalThis.crypto || globalThis.msCrypto function browserBytes (out, n) { for (let i = 0; i < n; i += QUOTA) {