Fix: always use promise in API call
This commit is contained in:
parent
e594b8ccb1
commit
3122d28c1a
|
@ -61,7 +61,6 @@ const msg = (() => {
|
||||||
|
|
||||||
function sendBg(data) {
|
function sendBg(data) {
|
||||||
if (bg === undefined) {
|
if (bg === undefined) {
|
||||||
// always wrap doSend in promise
|
|
||||||
return preparing.then(doSend);
|
return preparing.then(doSend);
|
||||||
}
|
}
|
||||||
return withPromiseError(doSend);
|
return withPromiseError(doSend);
|
||||||
|
@ -287,9 +286,9 @@ const msg = (() => {
|
||||||
|
|
||||||
const API = new Proxy({}, {
|
const API = new Proxy({}, {
|
||||||
get: (target, name) =>
|
get: (target, name) =>
|
||||||
(...args) => msg.sendBg({
|
(...args) => Promise.resolve(msg.sendBg({
|
||||||
method: 'invokeAPI',
|
method: 'invokeAPI',
|
||||||
name,
|
name,
|
||||||
args
|
args
|
||||||
})
|
}))
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user