Skip to content

Commit 91f7ea4

Browse files
author
cpv123
committed
Fix hoisting issue with javascript
1 parent 8f345ed commit 91f7ea4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

mint/js/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
11
const STORAGE_PROFILE = "githubProfile";
22
const STORAGE_REPOS = "githubRepos";
3-
const SyncStorage = window.chrome.storage.sync;
43

54
function chromeGetProfile() {
65
return new Promise((resolve) => {
7-
SyncStorage.get(STORAGE_PROFILE, (storage) => {
8-
resolve(storage.githubProfile);
6+
window.chrome.storage.sync.get(STORAGE_PROFILE, (storage) => {
7+
resolve(storage.githubProfile || "");
98
});
109
});
1110
}
1211

1312
function chromeGetRepos() {
1413
return new Promise((resolve) => {
15-
SyncStorage.get(STORAGE_REPOS, (storage) => {
16-
resolve(storage.githubRepos);
14+
window.chrome.storage.sync.get(STORAGE_REPOS, (storage) => {
15+
resolve(storage.githubRepos || []);
1716
});
1817
});
1918
}
2019

2120
function chromeSetProfile(profileName) {
2221
return new Promise((resolve) => {
23-
SyncStorage.set({ [STORAGE_PROFILE]: profileName }, () => {
22+
window.chrome.storage.sync.set({ [STORAGE_PROFILE]: profileName }, () => {
2423
resolve();
2524
});
2625
});
2726
}
2827

2928
function chromeSetRepos(repos) {
3029
return new Promise((resolve) => {
31-
SyncStorage.set({ [STORAGE_REPOS]: repos }, () => {
30+
window.chrome.storage.sync.set({ [STORAGE_REPOS]: repos }, () => {
3231
resolve();
3332
});
3433
});

0 commit comments

Comments
 (0)