소스 검색

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);