瀏覽代碼

use globalThis instead of window

Gildas 5 年之前
父節點
當前提交
633691f948
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      lib/single-file/single-file-core.js

+ 5 - 5
lib/single-file/single-file-core.js

@@ -21,14 +21,14 @@
  *   Source.
  */
 
-/* global window */
+/* global window, globalThis */
 
-this.singlefile.lib.core = this.singlefile.lib.core || (() => {
+this.singlefile.lib.core = this.singlefile.lib.core || (globalThis => {
 
 	const DEBUG = false;
 
-	const Set = window.Set;
-	const Map = window.Map;
+	const Set = globalThis.Set;
+	const Map = globalThis.Map;
 
 	let util, cssTree;
 
@@ -2229,4 +2229,4 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 
 	return { getClass };
 
-})();
+})(typeof globalThis == "object" ? globalThis : window);