CoAutoRunner

constructor(launcher: CoroutineLauncher, onChange: CoAutoRunOnChangeCallback<T>? = null, flowTransformer: AutoRunFlowTransformer = { conflatedWorker(transform = it) }, dispatcher: CoroutineDispatcher = dispatchers.main, withLoading: MutableStateFlow<Int>? = launcher.loading, immediate: Boolean = false, observer: CoAutoRunCallback<T>)

Parameters

launcher

The CoroutineLauncher to use.

onChange

Gets called when the observables change. Your onChange handler has to manually call run at any point (e.g. asynchronously) to change the tracked observables.

flowTransformer

How changes should be executed/collected. Defaults to conflatedWorker.

dispatcher

The CoroutineDispatcher to use. Defaults to dispatchers.main.

withLoading

Tracks loading state for the (re-)computation. Defaults to CoroutineLauncher.loading.

immediate

Whether to start tracking in a background coroutine immediately.

observer

The callback which is used to track the observables.