-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
弃用无 receiver 的事件扩展函数, 增加其 EventChannel receiver 版本替换 #1827
Labels
Milestone
Comments
Him188
added a commit
that referenced
this issue
Jan 6, 2022
…cFromEvent*`. Add their `EventChannel`-receiver counterparts. #1827
Him188
added a commit
that referenced
this issue
Jan 6, 2022
…cFromEvent*`. Add their `EventChannel`-receiver counterparts. #1827
Him188
added a commit
that referenced
this issue
Jan 6, 2022
…cFromEvent*`. Add their `EventChannel`-receiver counterparts. #1827
Him188
added a commit
that referenced
this issue
Jan 20, 2022
* Deprecate no-receiver functions `nextEvent*`, `syncFromEvent*`, `asyncFromEvent*`. Add their `EventChannel`-receiver counterparts. #1827 * Fix migration * Migrate `nextMessage` to new API
inshinno
pushed a commit
to inshinno/mirai
that referenced
this issue
Feb 21, 2022
* Deprecate no-receiver functions `nextEvent*`, `syncFromEvent*`, `asyncFromEvent*`. Add their `EventChannel`-receiver counterparts. mamoe#1827 * Fix migration * Migrate `nextMessage` to new API
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
动机
EventChannel
在 2.0 增加, 但原函数均不支持EventChannel
变更
弃用
逐渐弃用如下 8 个 top-level 函数:
nextEvent
nextEventAsync
nextEventOrNull
nextEventOrNullAsync
syncFromEvent
asyncFromEvent
syncFromEventOrNull
asyncFromEventOrNull
增加
新增 2 个
EventChannel
的扩展函数nextEvent
和syncFromEvent
:注意, 默认的优先级为
NORMAL
而不是原来的MONITOR
迁移方案
最终上述 8 个方法将简化为两个基础标准函数 (Extensions.kt) (见上 "变更").
超时, Async 和 OrNull 通过协程库的
CoroutineScope.async
,withTimeout
,withTimeoutOrNull
完成. 示例:自动迁移
nextEvent
: 替换为EventChannel.nextEvent
+withTimeout
nextEventAsync
: 无替换nextEventOrNull
: 替换为EventChannel.nextEvent
+withTimeoutOrNull
nextEventOrNullAsync
: 无替换syncFromEvent
: 替换为EventChannel.syncFromEvent
+withTimeout
asyncFromEvent
: 无替换syncFromEventOrNull
: 替换为EventChannel.syncFromEvent
+withTimeoutOrNull
asyncFromEventOrNull
: 无替换更新计划
EventChannel
receiver 版本替换 #1754)The text was updated successfully, but these errors were encountered: