addViewModelLifecycleObserver

fun addViewModelLifecycleObserver(onStateChanged: (viewModelState: ViewModelState) -> Unit)

Adds a ViewModelLifecycleObserver that will be notified when the ViewModelLifecycle changes state.

Parameters

onStateChanged

A receiver that has ViewModelState.


fun addViewModelLifecycleObserver(onInitialized: (owner: LifecycleOwner) -> Unit, onCleared: (owner: LifecycleOwner) -> Unit)

Adds a ViewModelLifecycleObserver that will be notified when the ViewModelLifecycle changes state.

Parameters

onInitialized

A receiver that will be invoked when the ViewModel is initialized.

onCleared

A receiver that will be invoked when the ViewModel is cleared.