ObservableComposition


A composition instance that supports observing lifecycle of its RecomposeScope.

Summary

Public functions

CompositionObserverHandle

Observe the composition.

Cmn

Public functions

setObserver

fun setObserver(observer: CompositionObserver): CompositionObserverHandle

Observe the composition. Calling this twice on the same composition will implicitly dispose the previous observer. the CompositionObserver will be called for this composition and all sub-composition, transitively, for which this composition is a context. If setObserver is called on a sub-composition, it will override the parent composition observer for itself and all its sub-compositions.

Parameters
observer: CompositionObserver

the observer that will be informed of composition events for this composition and all sub-compositions for which this composition is the composition context.

Returns
CompositionObserverHandle

a handle that allows the observer to be disposed and detached from the composition. Disposing an observer for a composition with a parent observer will begin sending the events to the parent composition's observer.