Skip to content
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

Nasa.user.getAddr() 有 bug,分析发现原来是钱包扩展的 bug #31

Open
cssmagic opened this issue Sep 2, 2018 · 2 comments
Open
Labels
bug Something isn't working

Comments

@cssmagic
Copy link
Member

cssmagic commented Sep 2, 2018

我只是在测试中发现了一个现象,暂时没有深入阅读钱包扩展的源码。

在每个交互周期内(页面 → 钱包扩展 → 页面),NasExtWallet.getUserAddress() 方法只能承载一个回调。也就是说,连续多次调用 NasExtWallet.getUserAddress(callback),最后一次注册的 callback 会覆盖之前的所有 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

@cssmagic cssmagic changed the title 借这里记录一下疑似 .user.getAddr() 有 bug,分析发现原来是钱包扩展的 bug Sep 2, 2018
@cssmagic cssmagic added the bug Something isn't working label Sep 2, 2018
@cssmagic
Copy link
Member Author

cssmagic commented Sep 2, 2018

为绕过此 bug,Nasa.user.getAddr() 需要短时间缓存取到的用户地址,避免重复调用 NasExtWallet.getUserAddress() 且回调被覆盖的情况。

@cssmagic cssmagic changed the title .user.getAddr() 有 bug,分析发现原来是钱包扩展的 bug Nasa.user.getAddr() 有 bug,分析发现原来是钱包扩展的 bug Sep 3, 2018
@cssmagic
Copy link
Member Author

cssmagic commented Sep 3, 2018

计划在 v0.2.0-beta.3 修复此问题。

计划在 v0.2.x 修复此问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant