Skip to content

Commit

Permalink
feat: Use globalThis if available
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed May 17, 2022
1 parent 00c89dc commit 3354c19
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -65,6 +65,9 @@
},
"eslintConfig": {
"extends": "./node_modules/kcd-scripts/eslint.js",
"globals": {
"globalThis": "readonly"
},
"rules": {
"react/prop-types": "off",
"react/no-adjacent-inline-elements": "off",
Expand Down
4 changes: 4 additions & 0 deletions src/act-compat.js
Expand Up @@ -4,6 +4,10 @@ const domAct = testUtils.act

function getGlobalThis() {
/* istanbul ignore else */
if (typeof globalThis !== 'undefined') {
return globalThis
}
/* istanbul ignore next */
if (typeof self !== 'undefined') {
return self
}
Expand Down

0 comments on commit 3354c19

Please sign in to comment.