Skip to content

Commit

Permalink
refactor: use polyfill but ignore type #1051
Browse files Browse the repository at this point in the history
  • Loading branch information
escapedcat committed Nov 15, 2022
1 parent c5f3262 commit 05fa220
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"jest": true
},
"rules": {
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": "allow-with-description"
}
],
"@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }], // No warnings for unused function arguments, which might be used in the future.
"no-console": ["error", { "allow": ["info", "warn", "error"] }],
"no-constant-binary-expression": "error",
Expand Down
11 changes: 8 additions & 3 deletions src/extension/background-script/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ const state = createState<State>((set, get) => ({
nostrPrivateKey: null,
password: async (password) => {
if (password) {
await chrome.storage.session.set({ password });
// @ts-ignore: https://github.com/mozilla/webextension-polyfill/issues/329
await browser.storage.session.set({ password });
}
const storageSessionPassword = await chrome.storage.session.get("password");
// @ts-ignore: https://github.com/mozilla/webextension-polyfill/issues/329
const storageSessionPassword = await browser.storage.session.get(
"password"
);

return storageSessionPassword.password;
},
Expand Down Expand Up @@ -124,7 +128,8 @@ const state = createState<State>((set, get) => ({
return nostr;
},
lock: async () => {
await chrome.storage.session.set({ password: null });
// @ts-ignore: https://github.com/mozilla/webextension-polyfill/issues/329
await browser.storage.session.set({ password: null });
const connector = await get().connector;
if (connector) {
await connector.unload();
Expand Down

0 comments on commit 05fa220

Please sign in to comment.