autoRun

Watches observables for changes. Often useful to keep things in sync (e.g. CoroutineLauncher -> UI).

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 CoroutineLauncher's scope completes.

See AutoRunner for more details.

Parameters

onChange

Gets called when the observables change. If you provide a handler you have to manually call run.

observer

The callback which is used to track the observables.


fun CoroutineScope.autoRun(launcher: CoroutineLauncher = SimpleCoroutineLauncher(this), onChange: AutoRunOnChangeCallback<Unit>? = null, observer: AutoRunCallback<Unit>): AutoRunner<Unit>

Watches observables for changes. Often useful to keep things in sync (e.g. ViewModel -> UI).

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 CoroutineScope completes.

See AutoRunner for more details.

Parameters

launcher

The CoroutineLauncher to use.

onChange

Gets called when the observables change. If you provide a handler you have to manually call run.

observer

The callback which is used to track the observables.