@happy-dom/global-registrator
Advanced tools
Comparing version 15.8.1 to 15.8.2
@@ -21,3 +21,3 @@ import { GlobalWindow, PropertySymbol } from 'happy-dom'; | ||
} | ||
const window = new GlobalWindow({ ...options, console: global.console }); | ||
const window = new GlobalWindow({ ...options, console: globalThis.console }); | ||
this.registered = {}; | ||
@@ -29,3 +29,3 @@ // Define properties on the global object | ||
const windowPropertyDescriptor = propertyDescriptors[key]; | ||
const globalPropertyDescriptor = Object.getOwnPropertyDescriptor(global, key); | ||
const globalPropertyDescriptor = Object.getOwnPropertyDescriptor(globalThis, key); | ||
if (globalPropertyDescriptor?.value === undefined || | ||
@@ -36,6 +36,6 @@ globalPropertyDescriptor?.value !== windowPropertyDescriptor.value) { | ||
if (windowPropertyDescriptor.value === window) { | ||
window[key] = global; | ||
windowPropertyDescriptor.value = global; | ||
window[key] = globalThis; | ||
windowPropertyDescriptor.value = globalThis; | ||
} | ||
Object.defineProperty(global, key, { | ||
Object.defineProperty(globalThis, key, { | ||
...windowPropertyDescriptor, | ||
@@ -54,6 +54,6 @@ configurable: true | ||
if (propertyDescriptor.value === window) { | ||
window[key] = global; | ||
propertyDescriptor.value = global; | ||
window[key] = globalThis; | ||
propertyDescriptor.value = globalThis; | ||
} | ||
Object.defineProperty(global, key, { | ||
Object.defineProperty(globalThis, key, { | ||
...propertyDescriptor, | ||
@@ -64,3 +64,3 @@ configurable: true | ||
// Set owner window on document to global | ||
global.document[PropertySymbol.defaultView] = global; | ||
globalThis.document[PropertySymbol.defaultView] = globalThis; | ||
} | ||
@@ -74,9 +74,9 @@ /** | ||
} | ||
const happyDOM = global.happyDOM; | ||
const happyDOM = globalThis.happyDOM; | ||
for (const key of Object.keys(this.registered)) { | ||
if (this.registered[key] !== null) { | ||
Object.defineProperty(global, key, this.registered[key]); | ||
Object.defineProperty(globalThis, key, this.registered[key]); | ||
} | ||
else { | ||
delete global[key]; | ||
delete globalThis[key]; | ||
} | ||
@@ -83,0 +83,0 @@ } |
{ | ||
"name": "@happy-dom/global-registrator", | ||
"version": "15.8.1", | ||
"version": "15.8.2", | ||
"license": "MIT", | ||
@@ -79,3 +79,3 @@ "homepage": "https://github.com/capricorn86/happy-dom/tree/master/packages/global-registrator", | ||
"dependencies": { | ||
"happy-dom": "^15.8.1" | ||
"happy-dom": "^15.8.2" | ||
}, | ||
@@ -82,0 +82,0 @@ "devDependencies": { |
@@ -31,3 +31,3 @@ import { GlobalWindow, PropertySymbol } from 'happy-dom'; | ||
const window = new GlobalWindow({ ...options, console: global.console }); | ||
const window = new GlobalWindow({ ...options, console: globalThis.console }); | ||
@@ -42,3 +42,3 @@ this.registered = {}; | ||
const windowPropertyDescriptor = propertyDescriptors[key]; | ||
const globalPropertyDescriptor = Object.getOwnPropertyDescriptor(global, key); | ||
const globalPropertyDescriptor = Object.getOwnPropertyDescriptor(globalThis, key); | ||
@@ -53,7 +53,7 @@ if ( | ||
if (windowPropertyDescriptor.value === window) { | ||
window[key] = global; | ||
windowPropertyDescriptor.value = global; | ||
window[key] = globalThis; | ||
windowPropertyDescriptor.value = globalThis; | ||
} | ||
Object.defineProperty(global, key, { | ||
Object.defineProperty(globalThis, key, { | ||
...windowPropertyDescriptor, | ||
@@ -75,7 +75,7 @@ configurable: true | ||
if (propertyDescriptor.value === window) { | ||
window[key] = global; | ||
propertyDescriptor.value = global; | ||
window[key] = globalThis; | ||
propertyDescriptor.value = globalThis; | ||
} | ||
Object.defineProperty(global, key, { | ||
Object.defineProperty(globalThis, key, { | ||
...propertyDescriptor, | ||
@@ -87,3 +87,3 @@ configurable: true | ||
// Set owner window on document to global | ||
global.document[PropertySymbol.defaultView] = global; | ||
globalThis.document[PropertySymbol.defaultView] = globalThis; | ||
} | ||
@@ -101,9 +101,9 @@ | ||
const happyDOM = global.happyDOM; | ||
const happyDOM = globalThis.happyDOM; | ||
for (const key of Object.keys(this.registered)) { | ||
if (this.registered[key] !== null) { | ||
Object.defineProperty(global, key, this.registered[key]); | ||
Object.defineProperty(globalThis, key, this.registered[key]); | ||
} else { | ||
delete global[key]; | ||
delete globalThis[key]; | ||
} | ||
@@ -110,0 +110,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25911
Updatedhappy-dom@^15.8.2