Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c80809a

Browse files
authored
feat: Use globalThis if available (#1070)
1 parent f176285 commit c80809a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

‎package.json‎

Lines changed: 3 additions & 0 deletions
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‎

Lines changed: 4 additions & 0 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /