Skip to content

Commit f01950c

Browse files
committed
Add stricter comparison between global and window objects.
Supports js-dom and faked DOM environments during Node testing. See #31 for more context.
1 parent 3c7aa53 commit f01950c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/custom-extend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Allows 'inherited' hook
44

55
let globalObj;
6-
if (typeof window === 'undefined') {
6+
if (typeof window === 'undefined' || window != (global as any)) {
77
globalObj = global;
88
} else {
99
globalObj = window;

src/util/extend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// use for non-typescript extends
33

44
let globalObj;
5-
if (typeof window === 'undefined') {
5+
if (typeof window === 'undefined' || window !== (global as any)) {
66
globalObj = global;
77
} else {
88
globalObj = window;

0 commit comments

Comments
 (0)