mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-23 06:10:30 +08:00
Make all event implementations internal
This commit is contained in:
parent
38748e0c10
commit
997261fa3b
@ -25,8 +25,8 @@ import kotlin.coroutines.coroutineContext
|
|||||||
import kotlin.jvm.JvmField
|
import kotlin.jvm.JvmField
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
@MiraiInternalAPI
|
@PublishedApi
|
||||||
fun <L : Listener<E>, E : Event> KClass<out E>.subscribeInternal(listener: L): L {
|
internal fun <L : Listener<E>, E : Event> KClass<out E>.subscribeInternal(listener: L): L {
|
||||||
with(this.listeners()) {
|
with(this.listeners()) {
|
||||||
addLast(listener)
|
addLast(listener)
|
||||||
listener.invokeOnCompletion {
|
listener.invokeOnCompletion {
|
||||||
|
@ -22,9 +22,8 @@ import java.util.function.Consumer
|
|||||||
import java.util.function.Function
|
import java.util.function.Function
|
||||||
import kotlin.coroutines.EmptyCoroutineContext
|
import kotlin.coroutines.EmptyCoroutineContext
|
||||||
|
|
||||||
@MiraiInternalAPI
|
|
||||||
@Suppress("FunctionName")
|
@Suppress("FunctionName")
|
||||||
fun <E : Event> Class<E>._subscribeEventForJaptOnly(
|
internal fun <E : Event> Class<E>._subscribeEventForJaptOnly(
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
onEvent: Function<E, ListeningStatus>
|
onEvent: Function<E, ListeningStatus>
|
||||||
): Listener<E> {
|
): Listener<E> {
|
||||||
@ -35,9 +34,8 @@ fun <E : Event> Class<E>._subscribeEventForJaptOnly(
|
|||||||
) { withContext(Dispatchers.IO) { onEvent.apply(it) } })
|
) { withContext(Dispatchers.IO) { onEvent.apply(it) } })
|
||||||
}
|
}
|
||||||
|
|
||||||
@MiraiInternalAPI
|
|
||||||
@Suppress("FunctionName")
|
@Suppress("FunctionName")
|
||||||
fun <E : Event> Class<E>._subscribeEventForJaptOnly(scope: CoroutineScope, onEvent: Consumer<E>): Listener<E> {
|
internal fun <E : Event> Class<E>._subscribeEventForJaptOnly(scope: CoroutineScope, onEvent: Consumer<E>): Listener<E> {
|
||||||
return this.kotlin.subscribeInternal(
|
return this.kotlin.subscribeInternal(
|
||||||
scope.Handler(
|
scope.Handler(
|
||||||
EmptyCoroutineContext,
|
EmptyCoroutineContext,
|
||||||
|
Loading…
Reference in New Issue
Block a user