observe

Function

Common
@ExperimentalComposeRuntimeApi
public fun Recomposer.observe(
    observer: CompositionRegistrationObserver
): CompositionObserverHandle

Register an observer to be notified when a composition is added to or removed from the given Recomposer. When this method is called, the observer will be notified of all currently registered compositions per the documentation in CompositionRegistrationObserver.onCompositionRegistered.

Parameters

observerthe observer that will be informed of new compositions registered with this Recomposer.

Returns

a handle that allows the observer to be disposed and detached from the Recomposer.