Inline ListenerBuilder

This commit is contained in:
Him188 2019-11-25 13:57:55 +08:00
parent b797ef3cc1
commit 361c0d4f03

View File

@ -136,9 +136,8 @@ suspend inline fun <reified E : Subscribable> subscribeAll(noinline listeners: s
*/ */
@ListenersBuilderDsl @ListenersBuilderDsl
@Suppress("MemberVisibilityCanBePrivate", "unused") @Suppress("MemberVisibilityCanBePrivate", "unused")
class ListenerBuilder<out E : Subscribable>( inline class ListenerBuilder<out E : Subscribable>(
@PublishedApi @PublishedApi internal inline val handlerConsumer: suspend (Listener<E>) -> Unit
internal val handlerConsumer: suspend (Listener<E>) -> Unit
) { ) {
suspend inline fun handler(noinline listener: suspend (E) -> ListeningStatus) { suspend inline fun handler(noinline listener: suspend (E) -> ListeningStatus) {
handlerConsumer(Handler(listener)) handlerConsumer(Handler(listener))