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.

Summary

Public functions

Unit
onCompositionRegistered(recomposer: Recomposer, composition: Composition)

Called whenever a Composition is registered with a Recomposer for which this is an observer.

Cmn
Unit
onCompositionUnregistered(
    recomposer: Recomposer,
    composition: Composition
)

Called whenever a Composition is unregistered with a Recomposer for which this is an observer.

Cmn

Public functions

onCompositionRegistered

fun onCompositionRegistered(recomposer: Recomposer, composition: Composition): Unit

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
recomposer: Recomposer

The Recomposer the composition was registered with. This is always the instance of the Recomposer that observe was called.

composition: Composition

The Composition instance that is being registered with the recomposer.

onCompositionUnregistered

fun onCompositionUnregistered(
    recomposer: Recomposer,
    composition: Composition
): Unit

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
recomposer: Recomposer

The Recomposer the composition was registered with. This is always the instance of the Recomposer that observe was called.

composition: Composition

The Composition instance that is being unregistered with the recomposer.