|
1 | 1 | const STORAGE_PROFILE = "githubProfile"; |
2 | 2 | const STORAGE_REPOS = "githubRepos"; |
3 | | -const SyncStorage = window.chrome.storage.sync; |
4 | 3 |
|
5 | 4 | function chromeGetProfile() { |
6 | 5 | 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 || ""); |
9 | 8 | }); |
10 | 9 | }); |
11 | 10 | } |
12 | 11 |
|
13 | 12 | function chromeGetRepos() { |
14 | 13 | 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 || []); |
17 | 16 | }); |
18 | 17 | }); |
19 | 18 | } |
20 | 19 |
|
21 | 20 | function chromeSetProfile(profileName) { |
22 | 21 | return new Promise((resolve) => { |
23 | | - SyncStorage.set({ [STORAGE_PROFILE]: profileName }, () => { |
| 22 | + window.chrome.storage.sync.set({ [STORAGE_PROFILE]: profileName }, () => { |
24 | 23 | resolve(); |
25 | 24 | }); |
26 | 25 | }); |
27 | 26 | } |
28 | 27 |
|
29 | 28 | function chromeSetRepos(repos) { |
30 | 29 | return new Promise((resolve) => { |
31 | | - SyncStorage.set({ [STORAGE_REPOS]: repos }, () => { |
| 30 | + window.chrome.storage.sync.set({ [STORAGE_REPOS]: repos }, () => { |
32 | 31 | resolve(); |
33 | 32 | }); |
34 | 33 | }); |
|
0 commit comments