mirror of
https://github.com/hmalik144/android-technical-task-moneybox.git
synced 2025-12-10 03:05:21 +00:00
9 lines
280 B
Kotlin
9 lines
280 B
Kotlin
package com.example.minimoneybox
|
|
|
|
import androidx.lifecycle.LiveData
|
|
import com.example.minimoneybox.ui.OneTimeObserver
|
|
|
|
fun <T> LiveData<T>.observeOnce(onChangeHandler: (T) -> Unit) {
|
|
val observer = OneTimeObserver(handler = onChangeHandler)
|
|
observe(observer, observer)
|
|
} |