Skip to content

Commit 305bcc7

Browse files
committed
adding firefox support phase 1
1 parent 210d356 commit 305bcc7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/lib/global/redux/helpers/storageFn.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function ChromeStorage() {
2-
const storage = chrome.storage.local;
2+
const storage = chrome?.storage?.local;
33
return {
44
getItem: (key: string): Promise<string> => {
55
return new Promise((resolve) => {
@@ -46,8 +46,12 @@ function LocalStorage() {
4646
}
4747

4848
const storageFn = () => {
49-
if (chrome?.storage?.sync) {
50-
return ChromeStorage();
49+
try {
50+
if (window.chrome && window.chrome?.storage?.sync) {
51+
return ChromeStorage();
52+
}
53+
} catch (e) {
54+
return LocalStorage();
5155
}
5256
return LocalStorage();
5357
};

0 commit comments

Comments
 (0)