INNER CODE UNIT · Kotlin

EmittedSource

M66B/FairEmail · app/src/main/java/androidx/lifecycle/CoroutineLiveData.kt:118

internal class EmittedSource(
    private val source: LiveData<*>,
    private val mediator: MediatorLiveData<*>,
) : DisposableHandle {
    // @MainThread
    private var disposed = false

    /**
     * Unlike [dispose] which cannot be sync because it not a coroutine (and we do not want to
     * lock), this version is a suspend function and does not return until source is removed.
     */
    suspend fun disposeNow() = withContext(Dispatchers.Main.immediate) { removeSource() }

    override fun dispose() {
        CoroutineScope(Dispatchers.Main.immediate).launch { removeSource() }
    }

    @MainThread

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…