From 81509bec19463d4567b0450a22c2d26ce2d53f82 Mon Sep 17 00:00:00 2001 From: Yelo Date: Thu, 21 Dec 2023 15:04:49 +0800 Subject: [PATCH] feat: add a fallback global scope --- lib/util.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/util.js b/lib/util.js index aaede5ad2..b983a5f8d 100644 --- a/lib/util.js +++ b/lib/util.js @@ -120,7 +120,11 @@ util.globalScope = (function() { return global; } - return typeof self === 'undefined' ? window : self; + return typeof self !== "undefined" + ? self + : typeof window !== "undefined" + ? window + : new Function("return this")(); })(); // define isArray