From 971c31f0c931f913d22a76ed488d9216ac04e306 Mon Sep 17 00:00:00 2001 From: evanvosberg Date: Thu, 19 Nov 2020 01:48:20 +0100 Subject: [PATCH] Add support for crypto from globalThis. --- src/core.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core.js b/src/core.js index a8a543e..e1330e7 100644 --- a/src/core.js +++ b/src/core.js @@ -17,6 +17,11 @@ var CryptoJS = CryptoJS || (function (Math, undefined) { crypto = self.crypto; } + // Native crypto from worker + if (typeof globalThis !== 'undefined' && globalThis.crypto) { + crypto = globalThis.crypto; + } + // Native (experimental IE 11) crypto from window (Browser) if (!crypto && typeof window !== 'undefined' && window.msCrypto) { crypto = window.msCrypto;