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

关于事件触发更新后,窗口活跃问题 #8

Open
Veng0923 opened this issue Nov 18, 2020 · 5 comments
Open

关于事件触发更新后,窗口活跃问题 #8

Veng0923 opened this issue Nov 18, 2020 · 5 comments

Comments

@Veng0923
Copy link

您好!!
现在有4个窗口,导航顺序M->A->B->C.
在C界面更改数据,触发事件,A,B窗口都监听该事件,并进行刷新.然后C返回(C close),此时展示B窗口.B返回(B close),展示界面仍是B,B再返回(B close),界面展示为M.
猜测,,在C返回到B时,活跃的窗口为A,后续调的也是A的close,再次返回时,才关闭B窗口,此时栈顶的窗口为M,展示为M

@Veng0923
Copy link
Author

如何在C返回时,正确活跃B窗口?

@xianjimli
Copy link
Member

不要猜测,调试一下。

@zxc3489
Copy link

zxc3489 commented Nov 19, 2020

不要猜测,调试一下。

本地测试了下,应该是和emitter_dispatch触发的顺序有关,在A B界面顺序emitter_on注册同一个事件后,由于A比B先注册,所以在emitter_dispatch时,B比A先触发回调。A B使用emitter_on注册不同事件,在C中先触发A的注册事件,再触发B的注册事件,返回B界面后,正常。想问一下,在emitter_dispatch触发回调后,是否有什么机制在修改当前顶层活跃窗口????本地测试结果,应该是有一个指针专门指向顶层窗口,还有一个链表保证窗口顺序和导航的顺序一致。

@Veng0923
Copy link
Author

我的猜测就是调试之后产生的,

@Veng0923
Copy link
Author

看了下源码
是有个单向链表,增加他是往头上增加,而不是在末尾增加.
现在我折中办法是分别注册两个事件,来调整触发顺序

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants