CompositionObserver


Observe when the composition begins and ends.

Summary

Public functions

Unit
onBeginComposition(
    composition: Composition,
    invalidationMap: Map<RecomposeScopeSet<Any>>
)

Called when the composition begins on the composition.

Cmn
Unit

Called after composition has been completed for composition.

Cmn

Public functions

onBeginComposition

fun onBeginComposition(
    composition: Composition,
    invalidationMap: Map<RecomposeScopeSet<Any>>
): Unit

Called when the composition begins on the composition. The invalidationMap a map of invalid recompose scopes that are scheduled to be recomposed. The CompositionObserver will be called for the composition.

The scopes in the invalidationMap are not guaranteed to be composed. Some cases where they are not composed are 1) the scope is no longer part of the composition (e.g the parent scope no longer executed the code branch the scope was a part of) 2) the scope is part of movable content that was moved out of the composition.

In the case of movable content, the scope will be recomposed as part of a different composition when it is moved to that composition or it might be discarded if no other composition claims it.

Parameters
composition: Composition

the composition that is beginning to be recomposed

invalidationMap: Map<RecomposeScopeSet<Any>>

the recompose scopes that will be recomposed by this composition. This list is empty for the initial composition.

onEndComposition

fun onEndComposition(composition: Composition): Unit

Called after composition has been completed for composition.