Skip to content

在@Listener监听的方法中,怎么阻止后续优先级低的监听方法执行呢 #62

Answered by ForteScarlet
Starxkif asked this question in Q&A
Discussion options

You must be logged in to vote

参考 此文档,当监听函数的返回结果为 EventResult 类型且其属性 isTruncated 指为 true 时将会截断后续其他监听函数的执行。

例如可以:

// Kotlin
return EventResult.truncate()
//
return EventResult.of(isTruncated = true)
// Java
return EventResult.truncate();
// 或
return EventResult.of(null, true);

可前往 API文档 搜索 EventResult 查询API

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Starxkif
Comment options

@ForteScarlet
Comment options

Answer selected by Starxkif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
模块:核心 与核心库相关的内容
2 participants