@happy-dom/global-registrator
Advanced tools
Comparing version 2.55.0 to 3.0.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var happy_dom_1 = require("happy-dom"); | ||
const happy_dom_1 = require("happy-dom"); | ||
/** | ||
* | ||
*/ | ||
var GlobalRegistrator = /** @class */ (function () { | ||
function GlobalRegistrator() { | ||
} | ||
class GlobalRegistrator { | ||
/** | ||
* Registers Happy DOM globally. | ||
*/ | ||
GlobalRegistrator.register = function () { | ||
static register() { | ||
if (this.registered.length) { | ||
throw new Error('Failed to registered. Happy DOM has already been globally registered.'); | ||
} | ||
var window = new happy_dom_1.Window(); | ||
for (var _i = 0, _a = Object.keys(window); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
const window = new happy_dom_1.GlobalWindow(); | ||
for (const key of Object.keys(window)) { | ||
if (global[key] === undefined && key !== 'undefined') { | ||
@@ -25,19 +22,17 @@ global[key] = window[key]; | ||
} | ||
}; | ||
} | ||
/** | ||
* Registers Happy DOM globally. | ||
*/ | ||
GlobalRegistrator.unregister = function () { | ||
static unregister() { | ||
if (this.registered.length) { | ||
throw new Error('Failed to unregistered. Happy DOM has not previously been globally registered.'); | ||
} | ||
for (var _i = 0, _a = this.registered; _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
for (const key of this.registered) { | ||
delete global[key]; | ||
} | ||
}; | ||
GlobalRegistrator.registered = []; | ||
return GlobalRegistrator; | ||
}()); | ||
} | ||
} | ||
exports.default = GlobalRegistrator; | ||
GlobalRegistrator.registered = []; | ||
//# sourceMappingURL=GlobalRegistrator.js.map |
@@ -7,4 +7,4 @@ "use strict"; | ||
exports.GlobalRegistrator = void 0; | ||
var GlobalRegistrator_1 = __importDefault(require("./GlobalRegistrator")); | ||
const GlobalRegistrator_1 = __importDefault(require("./GlobalRegistrator")); | ||
exports.GlobalRegistrator = GlobalRegistrator_1.default; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@happy-dom/global-registrator", | ||
"version": "2.55.0", | ||
"version": "3.0.0", | ||
"license": "MIT", | ||
@@ -35,3 +35,3 @@ "homepage": "https://github.com/capricorn86/happy-dom/tree/master/packages/global-registrator", | ||
"dependencies": { | ||
"happy-dom": "^2.55.0" | ||
"happy-dom": "^3.0.0" | ||
}, | ||
@@ -55,3 +55,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "9b316ff50ad3271b04e60cfa15d93ce9c8b524bc" | ||
"gitHead": "8fff87a5f5379366c44e8f2b5e21f4dd6a6a4cc2" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Window } from 'happy-dom'; | ||
import { GlobalWindow } from 'happy-dom'; | ||
@@ -16,3 +16,3 @@ /** | ||
} | ||
const window = new Window(); | ||
const window = new GlobalWindow(); | ||
for (const key of Object.keys(window)) { | ||
@@ -19,0 +19,0 @@ if (global[key] === undefined && key !== 'undefined') { |
@@ -6,3 +6,3 @@ { | ||
"tsBuildInfoFile": "tmp/.tsbuildinfo", | ||
"target": "es5", | ||
"target": "es2020", | ||
"declaration": true, | ||
@@ -9,0 +9,0 @@ "module": "CommonJS", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
11513
191
+ Addedhappy-dom@3.2.2(transitive)
- Removedhappy-dom@2.55.0(transitive)
Updatedhappy-dom@^3.0.0