Skip to content

Commit 4df5d4d

Browse files
committed
feat: Use globalThis if available
1 parent f176285 commit 4df5d4d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@
6565
},
6666
"eslintConfig": {
6767
"extends": "./node_modules/kcd-scripts/eslint.js",
68+
"globals": {
69+
"globalThis": "readonly"
70+
},
6871
"rules": {
6972
"react/prop-types": "off",
7073
"react/no-adjacent-inline-elements": "off",

src/act-compat.js

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ const domAct = testUtils.act
44

55
function getGlobalThis() {
66
/* istanbul ignore else */
7+
if (typeof globalThis !== 'undefined') {
8+
return globalThis
9+
}
10+
/* istanbul ignore next */
711
if (typeof self !== 'undefined') {
812
return self
913
}

0 commit comments

Comments
 (0)