Skip to content

Commit

Permalink
adding firefox support phase 1
Browse files Browse the repository at this point in the history
  • Loading branch information
alekangelov committed Jul 4, 2021
1 parent 210d356 commit 305bcc7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/lib/global/redux/helpers/storageFn.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function ChromeStorage() {
const storage = chrome.storage.local;
const storage = chrome?.storage?.local;
return {
getItem: (key: string): Promise<string> => {
return new Promise((resolve) => {
Expand Down Expand Up @@ -46,8 +46,12 @@ function LocalStorage() {
}

const storageFn = () => {
if (chrome?.storage?.sync) {
return ChromeStorage();
try {
if (window.chrome && window.chrome?.storage?.sync) {
return ChromeStorage();
}
} catch (e) {
return LocalStorage();
}
return LocalStorage();
};
Expand Down

0 comments on commit 305bcc7

Please sign in to comment.