diff --git a/src/core/helpers/promise.js b/src/core/helpers/promise.js index f36f5a54cc76ac172e88a1c32fea59b248420d08..d6704f500e103a27ff9f41381f344b77197367be 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) }))) } -} +}