We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 210d356 commit 305bcc7Copy full SHA for 305bcc7
src/lib/global/redux/helpers/storageFn.ts
@@ -1,5 +1,5 @@
1
function ChromeStorage() {
2
- const storage = chrome.storage.local;
+ const storage = chrome?.storage?.local;
3
return {
4
getItem: (key: string): Promise<string> => {
5
return new Promise((resolve) => {
@@ -46,8 +46,12 @@ function LocalStorage() {
46
}
47
48
const storageFn = () => {
49
- if (chrome?.storage?.sync) {
50
- return ChromeStorage();
+ try {
+ if (window.chrome && window.chrome?.storage?.sync) {
51
+ return ChromeStorage();
52
+ }
53
+ } catch (e) {
54
+ return LocalStorage();
55
56
return LocalStorage();
57
};
0 commit comments