Package com.drake.channel

Functions

receiveEvent
Link copied to clipboard
inline fun <T> LifecycleOwner.receiveEvent(vararg tags: String? = emptyArray(), lifeEvent: Lifecycle.Event = Lifecycle.Event.ON_DESTROY, noinline block: suspend CoroutineScope.(T) -> Unit): Job
接收事件
receiveEventHandler
Link copied to clipboard
inline fun <T> receiveEventHandler(vararg tags: String? = arrayOf(), noinline block: suspend CoroutineScope.(T) -> Unit): Job
接收事件, 此事件要求执行kotlinx.coroutines.cancel手动注销
receiveEventLive
Link copied to clipboard
inline fun <T> LifecycleOwner.receiveEventLive(vararg tags: String? = arrayOf(), lifeEvent: Lifecycle.Event = Lifecycle.Event.ON_DESTROY, noinline block: suspend CoroutineScope.(T) -> Unit): Job
使用LiveData将消息延迟到前台接收
receiveTag
Link copied to clipboard
fun LifecycleOwner.receiveTag(vararg tags: String?, lifeEvent: Lifecycle.Event = Lifecycle.Event.ON_DESTROY, block: suspend CoroutineScope.(tag: String) -> Unit): Job
接收标签, 和receiveEvent不同之处在于该函数仅支持标签, 不支持事件+标签
receiveTagHandler
Link copied to clipboard
fun receiveTagHandler(vararg tags: String?, block: suspend CoroutineScope.(tag: String) -> Unit): Job
接收标签, 和receiveEvent不同之处在于该函数仅支持标签, 不支持事件+标签, 此事件要求执行kotlinx.coroutines.cancel手动注销
receiveTagLive
Link copied to clipboard
fun LifecycleOwner.receiveTagLive(vararg tags: String?, lifeEvent: Lifecycle.Event = Lifecycle.Event.ON_DESTROY, block: suspend CoroutineScope.(tag: String) -> Unit): Job
使用LiveData将消息延迟到前台接收
sendEvent
Link copied to clipboard
fun sendEvent(event: Any, tag: String? = null): Job
发送事件
sendTag
Link copied to clipboard
fun sendTag(tag: String?): Job
发送标签