coAutoRun
Watches observables for changes. Often useful to keep things in sync.
This is a convenience function that immediately starts the AutoRunner.run cycle for you.
Returns the underlying AutoRunner. To stop watching, you should call AutoRunner.dispose. The AutoRunner is automatically disposed when the viewModelScope completes.
See AutoRunner for more details.
Parameters
Gets called when the observables change. If you provide a handler you have to manually call run.
The callback which is used to track the observables.
Watches observables for changes. Often useful to keep things in sync (e.g. ViewModel -> UI).
This only executes the observer between onStart
/onStop
.
Returns the underlying AutoRunner. To stop watching, you should call AutoRunner.dispose. The AutoRunner is automatically disposed on Activity.onDestroy
/Fragment.onDestroyView
.
See AutoRunner for more details.
Parameters
Gets called when the observables change. If you provide a handler you have to manually call run.
How changes should be executed/collected. Defaults to conflatedWorker.
The CoroutineDispatcher to use. Defaults to dispatchers.main
.
Tracks loading state for the (re-)computation. Defaults to CoroutineLauncher.loading if this is a CoroutineLauncher or null
otherwise.
The callback which is used to track the observables.