Skip to content

Commit

Permalink
fix: change globalThis reference to window.globalThis (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelonsouza committed Sep 30, 2022
1 parent ecaebfb commit 296629d
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 407 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "encrypt-storage",
"version": "2.12.8",
"version": "2.12.9",
"description": "Wrapper for encrypted localStorage and sessionStorage in browser",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -86,21 +86,21 @@
"@types/crypto-js": "^4.1.1",
"@types/faker": "^5.5.9",
"@types/jest": "^28.1.8",
"@types/node": "^18.7.14",
"@types/node": "^18.7.23",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.38.0",
"@typescript-eslint/parser": "^5.38.1",
"assert": "^2.0.0",
"buffer": "^6.0.3",
"copy-webpack-plugin": "^11.0.0",
"coveralls": "^3.1.1",
"eslint": "^8.23.1",
"eslint": "^8.24.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.5.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"faker": "^5.5.3",
"git-commit-msg-linter": "^4.1.3",
"git-commit-msg-linter": "^4.2.1",
"https-browserify": "^1.0.0",
"husky": "^8.0.1",
"jest": "^28.1.3",
Expand All @@ -117,7 +117,7 @@
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"ts-jest": "^28.0.8",
"ts-loader": "^9.3.1",
"ts-loader": "^9.4.1",
"typescript": "^4.8.3",
"url": "^0.11.0",
"webpack": "^5.74.0",
Expand Down
4 changes: 2 additions & 2 deletions src/async-encrypt-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ export class AsyncEncryptStorage {
}

/* istanbul ignore next */
if (window && globalThis) {
if (window && window?.globalThis) {
/* istanbul ignore next */
(window as any).AsyncEncryptStorage = AsyncEncryptStorage;
/* istanbul ignore next */
(globalThis as any).AsyncEncryptStorage = AsyncEncryptStorage;
(window?.globalThis as any).AsyncEncryptStorage = AsyncEncryptStorage;
}
4 changes: 2 additions & 2 deletions src/encrypt-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,11 @@ export class EncryptStorage implements EncryptStorageInterface {
}

/* istanbul ignore next */
if (window && globalThis) {
if (window && window?.globalThis) {
/* istanbul ignore next */
(window as any).EncryptStorage = EncryptStorage;
/* istanbul ignore next */
(globalThis as any).EncryptStorage = EncryptStorage;
(window?.globalThis as any).EncryptStorage = EncryptStorage;
}

export default EncryptStorage;
Loading

0 comments on commit 296629d

Please sign in to comment.