Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

[Refactor] notify opensumi core by event #57

Closed
tyn1998 opened this issue Aug 24, 2022 · 4 comments · Fixed by #58
Closed

[Refactor] notify opensumi core by event #57

tyn1998 opened this issue Aug 24, 2022 · 4 comments · Fixed by #58

Comments

@tyn1998
Copy link
Owner

tyn1998 commented Aug 24, 2022

rather depending opensumi core to keep polling for the states of opensumi devtools, which is energy consuming.

See: opensumi/core#1560 (comment)

@tyn1998
Copy link
Owner Author

tyn1998 commented Aug 24, 2022

考虑到一种情况:

devtools在生命周期贡献点还没有注册完之前就打开,此时流量延迟功能不能用,如果这个时候devtools只向core通知一次,那么就太早了,没用。

应对策略可以是:

core收到devtools的通知后,开启延迟测试功能,并通过某种方式告诉devtools响应成功;如果devtools没收到这个反馈,则每隔1秒重试1次,直到响应成功。

@tyn1998
Copy link
Owner Author

tyn1998 commented Aug 24, 2022

使用event的方法:

image

https://stackoverflow.com/a/9418326/10369621

@tyn1998
Copy link
Owner Author

tyn1998 commented Aug 24, 2022

另一种情况:

devtools在捕捉状态时,页面刷新,则流量延迟功能由于页面重载就停了。

@tyn1998
Copy link
Owner Author

tyn1998 commented Aug 24, 2022

两种情况都用这个方法就能解决:

image

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

Successfully merging a pull request may close this issue.

1 participant