---
title: "ObservableComposition"
description: "A composition instance that supports observing lifecycle of its [RecomposeScope]."
type: "interface"
---

<div class='type'>Interface</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>



```kotlin
@ExperimentalComposeRuntimeApi
public interface ObservableComposition
```


A composition instance that supports observing lifecycle of its `RecomposeScope`.


## Functions

```kotlin
public 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 | 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

| | |
| --- | --- |
|  | 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. |




