We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
NasExtWallet.getUserAddress()
我只是在测试中发现了一个现象,暂时没有深入阅读钱包扩展的源码。
在每个交互周期内(页面 → 钱包扩展 → 页面),NasExtWallet.getUserAddress() 方法只能承载一个回调。也就是说,连续多次调用 NasExtWallet.getUserAddress(callback),最后一次注册的 callback 会覆盖之前的所有 callback。
NasExtWallet.getUserAddress(callback)
比如有以下代码:
NasExtWallet.getUserAddress(function () { console.log(1) }) NasExtWallet.getUserAddress(function () { console.log(2) }) NasExtWallet.getUserAddress(function () { console.log(3) }) NasExtWallet.getUserAddress(function () { console.log(4) })
会在控制台得到 4 4 4 4,而不是 1 2 3 4。
4
1
2
3
Original issue: NasaTeam/Nasa.js#31
The text was updated successfully, but these errors were encountered:
这是一个比较边缘的情况,遇到的概率可能不大,不过最好还是能修一下。
这个 bug 在一定程度上也说明异步通信可能比我们想像得要复杂。因此还是希望钱包扩展与页面的通信机制能修改( #38 ),这样对于扩展的开发者和 DApp 的开发者来说,都是成本的降低。
Sorry, something went wrong.
No branches or pull requests
我只是在测试中发现了一个现象,暂时没有深入阅读钱包扩展的源码。
在每个交互周期内(页面 → 钱包扩展 → 页面),
NasExtWallet.getUserAddress()
方法只能承载一个回调。也就是说,连续多次调用NasExtWallet.getUserAddress(callback)
,最后一次注册的 callback 会覆盖之前的所有 callback。比如有以下代码:
会在控制台得到
4
4
4
4
,而不是1
2
3
4
。Original issue: NasaTeam/Nasa.js#31
The text was updated successfully, but these errors were encountered: