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

不要直接使用 GlobalEventChannel #8

Closed
cssxsh opened this issue Oct 26, 2022 · 1 comment
Closed

不要直接使用 GlobalEventChannel #8

cssxsh opened this issue Oct 26, 2022 · 1 comment

Comments

@cssxsh
Copy link

cssxsh commented Oct 26, 2022

直接从 GlobalEventChannel 得到的监听器不受 插件生命周期管理

var channel: EventChannel<Event> = GlobalEventChannel

你应该使用 CoroutineScope.globalEventChannel() 这个扩展方法,
KotlinPlugin/JvmPlugin 就是 CoroutineScope 的子类实现

所以你可以 直接使用 var channel: EventChannel<Event> = globalEventChannel() 替换原本的代码

@xszqxszq
Copy link
Owner

xszqxszq commented Nov 1, 2022

👌

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

2 participants