Fix: don't dup promisify in prefs
This commit is contained in:
parent
d4ddfcc713
commit
2aff14e213
|
@ -406,6 +406,7 @@ function onRuntimeMessage(msg, sender) {
|
|||
return fn.apply(context, msg.args);
|
||||
}
|
||||
|
||||
// FIXME: popup.js also open editor but it doesn't use this API.
|
||||
function openEditor({id}) {
|
||||
let url = '/edit.html';
|
||||
if (id) {
|
||||
|
|
18
js/prefs.js
18
js/prefs.js
|
@ -1,3 +1,4 @@
|
|||
/* global promisify */
|
||||
/* exported prefs */
|
||||
'use strict';
|
||||
|
||||
|
@ -179,23 +180,6 @@ const prefs = (() => {
|
|||
},
|
||||
};
|
||||
|
||||
function promisify(fn) {
|
||||
return (...args) =>
|
||||
new Promise((resolve, reject) => {
|
||||
fn(...args, (...result) => {
|
||||
if (chrome.runtime.lastError) {
|
||||
reject(chrome.runtime.lastError);
|
||||
} else if (result.length === 0) {
|
||||
resolve(undefined);
|
||||
} else if (result.length === 1) {
|
||||
resolve(result[0]);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function setAll(settings, synced) {
|
||||
for (const [key, value] of Object.entries(settings)) {
|
||||
set(key, value, synced);
|
||||
|
|
|
@ -151,11 +151,11 @@
|
|||
<link rel="stylesheet" href="manage/config-dialog.css">
|
||||
<script src="manage/config-dialog.js"></script>
|
||||
|
||||
<script src="js/promisify.js"></script>
|
||||
<script src="js/dom.js"></script>
|
||||
<script src="js/messaging.js"></script>
|
||||
<script src="js/localization.js"></script>
|
||||
<script src="js/prefs.js"></script>
|
||||
<script src="js/promisify.js"></script>
|
||||
<script src="js/msg.js"></script>
|
||||
<script src="content/apply.js"></script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user