Skip to content

Commit

Permalink
Merge pull request #865 from NordicSemiconductor/fix/main-thread-pers…
Browse files Browse the repository at this point in the history
…istent-store

fix: allow main thread code to import persistent store (and through t…
  • Loading branch information
boundlesscalm authored Jan 16, 2024
2 parents 2ef4582 + 06235a6 commit 6a5e860
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ every new version is a new major version.

- `openFile` export.

### Changed

- Updated `es6` -> `es2021` in eslint config `env`.

### Fixed

- Make new `isVerboseLogging` persistent setting get/set compatible with Main
thread code (by using `globalThis` instead of `window`).

## 148.0.0 - 2024-01-16

### Added
Expand Down
2 changes: 1 addition & 1 deletion config/eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ module.exports = {
'md',
],
env: {
es6: true,
es2021: true,
browser: true,
node: true,
jasmine: true,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/persistentStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ export const getIsLoggingVerbose = () =>
);

const resetIsLoggingVerbose = () => persistIsLoggingVerbose(false);
window.addEventListener('beforeunload', resetIsLoggingVerbose);
globalThis.addEventListener?.('beforeunload', resetIsLoggingVerbose);
export const doNotResetVerboseLogginOnRestart = () =>
window.removeEventListener('beforeunload', resetIsLoggingVerbose);
globalThis.removeEventListener?.('beforeunload', resetIsLoggingVerbose);

export const getPersistedLogVisible = () =>
getAppSpecificStore<SharedAppSpecificStoreSchema>().get(`isLogVisible`);

0 comments on commit 6a5e860

Please sign in to comment.