From 4151f0d4048e094e7acbc8e29ef18f103e1cf443 Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Thu, 9 Apr 2020 17:49:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DcreateBLEConnection?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=A2=ABpromise=E5=8C=96=E7=9A=84Bug=20#1543?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/helpers/promise.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/helpers/promise.js b/src/core/helpers/promise.js index f36f5a54c..d6704f500 100644 --- a/src/core/helpers/promise.js +++ b/src/core/helpers/promise.js @@ -12,14 +12,18 @@ const SYNC_API_RE = const CONTEXT_API_RE = /^create|Manager$/ +// Context例外情况 +const CONTEXT_API_RE_EXC = ['createBLEConnection'] + const TASK_APIS = ['request', 'downloadFile', 'uploadFile', 'connectSocket'] +// 同步例外情况 const ASYNC_API = ['createBLEConnection'] const CALLBACK_API_RE = /^on|^off/ export function isContextApi (name) { - return CONTEXT_API_RE.test(name) + return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1 } export function isSyncApi (name) { return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1 @@ -79,4 +83,4 @@ export function promisify (name, api) { }), ...params) }))) } -} +} -- GitLab