From 3122d28c1ada62e31fcc7076ec5487e4811cef1d Mon Sep 17 00:00:00 2001 From: eight Date: Sat, 6 Oct 2018 15:14:05 +0800 Subject: [PATCH] Fix: always use promise in API call --- js/msg.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/js/msg.js b/js/msg.js index 0e707c45..df23df00 100644 --- a/js/msg.js +++ b/js/msg.js @@ -61,7 +61,6 @@ const msg = (() => { function sendBg(data) { if (bg === undefined) { - // always wrap doSend in promise return preparing.then(doSend); } return withPromiseError(doSend); @@ -287,9 +286,9 @@ const msg = (() => { const API = new Proxy({}, { get: (target, name) => - (...args) => msg.sendBg({ + (...args) => Promise.resolve(msg.sendBg({ method: 'invokeAPI', name, args - }) + })) });