Sfoglia il codice sorgente

use globalThis instead of window

Gildas 5 anni fa
parent
commit
633691f948
1 ha cambiato i file con 5 aggiunte e 5 eliminazioni
  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);