observeReads

fun <T : Any> observeReads(target: T, onChanged: (T) -> Unit, block: () -> Unit)

Executes block, observing state object reads during its execution.

The target and onChanged are associated with any values that are read so that when those values change, onChanged can be called with the target parameter.

Observation for target will be paused when a new observeReads call is made or when pauseObservingReads is called.

Any previous observation with the given target and onChanged will be cleared when the onChanged is called for target. The onChanged should trigger a new observeReads call to resubscribe to changes. They may also be cleared using removeObservationsFor or clear.