-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
异步函数 uni.createBLEConnection 没有被 Promisify #1543
Comments
你用的什么版本的HBuilderX?这个问题在2.6.6-alpha已经修复了 |
@Wangyaqi 用的是 cli 版的,npm run info 信息如下
|
而且我看这个仓库里 master, alpha, dev 分支下 packages/uni-mp-weixin/dist/index.js 代码也还都是有问题的 |
了解,现在改一下,上次这个修改是不回调的问题 |
Wangyaqi
added a commit
that referenced
this issue
Apr 9, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
[问题描述:尽可能简洁清晰地把问题描述清楚]
uni.createBLEConnection
是一个异步函数,框架没有把他Promisify
,返回的不是Promise
复现步骤
[复现问题的步骤]
可以看到返回值不是 Promise
预期结果
[使用简洁清晰的语言描述你希望生效的预期结果]
实际结果
[这里请贴上你的报错截图或文字]
系统信息:
补充信息
[可选]
[根据你的分析,出现这个问题的原因可能在哪里?]
@dcloudio/uni-mp-weixin/index.js
中判断是否被Promisify
的逻辑如下可以看到,在
shouldPromise
中执行isContextApi(name)
时,因为createBLEConnection
是create
开头的,满足了isContextApi
的条件,返回了true
, 导致shouldPromise
返回了false
。代码中存在const ASYNC_API = ['createBLEConnection'];
片段,可以看出考虑了这个函数的Promisify
,却有逻辑漏洞。将isContextApi
函数修改为以下逻辑可修复错误The text was updated successfully, but these errors were encountered: