Skip to content

Instantly share code, notes, and snippets.

@prasad79
prasad79 / EventBus.kt
Created March 7, 2019 16:35
Kotlin coroutine-based event bus
import kotlinx.coroutines.experimental.DefaultDispatcher
import kotlinx.coroutines.experimental.channels.BroadcastChannel
import kotlinx.coroutines.experimental.channels.ReceiveChannel
import kotlinx.coroutines.experimental.channels.filter
import kotlinx.coroutines.experimental.channels.map
import kotlinx.coroutines.experimental.launch
import kotlin.coroutines.experimental.CoroutineContext
class EventBus {