mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-24 14:30:09 +08:00
Add Java-friendly EventChannel.exceptionHandler API, close #1953
This commit is contained in:
parent
bcaf9b5060
commit
1a2241b8b2
@ -1737,6 +1737,7 @@ public abstract class net/mamoe/mirai/event/EventChannel {
|
||||
public static synthetic fun asChannel$default (Lnet/mamoe/mirai/event/EventChannel;ILkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;ILjava/lang/Object;)Lkotlinx/coroutines/channels/Channel;
|
||||
public abstract fun asFlow ()Lkotlinx/coroutines/flow/Flow;
|
||||
public abstract fun context ([Lkotlin/coroutines/CoroutineContext;)Lnet/mamoe/mirai/event/EventChannel;
|
||||
public final fun exceptionHandler (Ljava/util/function/Consumer;)Lnet/mamoe/mirai/event/EventChannel;
|
||||
public final fun exceptionHandler (Lkotlin/jvm/functions/Function1;)Lnet/mamoe/mirai/event/EventChannel;
|
||||
public final fun exceptionHandler (Lkotlinx/coroutines/CoroutineExceptionHandler;)Lnet/mamoe/mirai/event/EventChannel;
|
||||
public final fun filter (Lkotlin/jvm/functions/Function1;)Lnet/mamoe/mirai/event/EventChannel;
|
||||
|
@ -1737,6 +1737,7 @@ public abstract class net/mamoe/mirai/event/EventChannel {
|
||||
public static synthetic fun asChannel$default (Lnet/mamoe/mirai/event/EventChannel;ILkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;ILjava/lang/Object;)Lkotlinx/coroutines/channels/Channel;
|
||||
public abstract fun asFlow ()Lkotlinx/coroutines/flow/Flow;
|
||||
public abstract fun context ([Lkotlin/coroutines/CoroutineContext;)Lnet/mamoe/mirai/event/EventChannel;
|
||||
public final fun exceptionHandler (Ljava/util/function/Consumer;)Lnet/mamoe/mirai/event/EventChannel;
|
||||
public final fun exceptionHandler (Lkotlin/jvm/functions/Function1;)Lnet/mamoe/mirai/event/EventChannel;
|
||||
public final fun exceptionHandler (Lkotlinx/coroutines/CoroutineExceptionHandler;)Lnet/mamoe/mirai/event/EventChannel;
|
||||
public final fun filter (Lkotlin/jvm/functions/Function1;)Lnet/mamoe/mirai/event/EventChannel;
|
||||
|
@ -314,6 +314,17 @@ public abstract class EventChannel<out BaseEvent : Event> @MiraiInternalApi publ
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个新的 [EventChannel], 该 [EventChannel] 包含 [`this.coroutineContext`][defaultCoroutineContext] 和添加的 [coroutineExceptionHandler]
|
||||
* @see context
|
||||
* @since 2.12
|
||||
*/
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
public fun exceptionHandler(coroutineExceptionHandler: Consumer<Throwable>): EventChannel<BaseEvent> {
|
||||
return exceptionHandler { coroutineExceptionHandler.accept(it) }
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 [coroutineScope] 作为这个 [EventChannel] 的父作用域.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user