Fix: return promise in prefs.set
This commit is contained in:
parent
67cad1176c
commit
e257ff2985
|
@ -107,7 +107,10 @@ const prefs = (() => {
|
|||
specific: new Map(),
|
||||
};
|
||||
|
||||
const initializing = promisify(chrome.storage.sync.get.bind(chrome.storage.sync))('settings')
|
||||
const syncSet = promisify(chrome.storage.sync.set.bind(chrome.storage.sync));
|
||||
const syncGet = promisify(chrome.storage.sync.get.bind(chrome.storage.sync));
|
||||
|
||||
const initializing = syncGet('settings')
|
||||
.then(result => {
|
||||
if (result.settings) {
|
||||
setAll(result.settings, true);
|
||||
|
@ -234,7 +237,7 @@ const prefs = (() => {
|
|||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
timer = null;
|
||||
chrome.storage.sync.set({settings: values})
|
||||
syncSet({settings: values})
|
||||
.then(resolve, reject);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -143,6 +143,7 @@
|
|||
<label>
|
||||
<span>Cloud drive</span>
|
||||
<select class="cloud-name">
|
||||
<option value="none">None</option>
|
||||
<option value="dropbox">Dropbox</option>
|
||||
</select>
|
||||
</label>
|
||||
|
|
|
@ -105,6 +105,9 @@ document.onclick = e => {
|
|||
|
||||
connectButton.addEventListener('click', e => {
|
||||
if (validClick(e)) {
|
||||
if (cloud.value === 'none') {
|
||||
return;
|
||||
}
|
||||
connectButton.disabled = true;
|
||||
cloud.disabled = true;
|
||||
prefs.set('sync.enabled', cloud.value)
|
||||
|
@ -124,7 +127,7 @@ document.onclick = e => {
|
|||
.then(() => API.syncStop())
|
||||
.catch(console.error)
|
||||
.then(() => {
|
||||
connectButton.enabled = true;
|
||||
connectButton.disabled = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user