CompositionRegistrationObserver
@ExperimentalComposeRuntimeApi
public interface CompositionRegistrationObserver
Observe when new compositions are added to a recomposer. This, combined with,
CompositionObserver
, allows observing when any composition is being performed.
This observer is registered with a Recomposer
by calling Recomposer.observe
.
Functions
public fun onCompositionRegistered(composition: ObservableComposition)
Called whenever a Composition
is registered with a Recomposer
for which this is an
observer. A Composition is registered with its Recomposer when it begins its initial
composition, before any content is added. When a CompositionRegistrationObserver
is
registered, this method will be called for all the Recomposer
's currently known
composition.
This method is called on the same thread that the Composition
being registered is being
composed on. During the initial dispatch, it is invoked on the same thread that the callback
is being registered on. Implementations of this method should be thread safe as they might be
called on an arbitrary thread.
Parameters
composition | The Composition instance that is being registered with the recomposer. |
public fun onCompositionUnregistered(composition: ObservableComposition)
Called whenever a Composition
is unregistered with a Recomposer
for which this is an
observer. A Composition is unregistered from its Recomposer when the composition is
disposed
. This method is called on the same thread that the
Composition
being unregistered was composed on. Implementations of this method should be
thread safe as they might be called on an arbitrary thread.
Parameters
composition | The Composition instance that is being unregistered with the recomposer. |