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


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


<h2 id="createlifecycleawarewindowrecomposer-coroutinecontext-lifecycle">createLifecycleAwareWindowRecomposer</h2>

<div class='sourceset sourceset-android'>Android</div>


```kotlin
fun View.createLifecycleAwareWindowRecomposer(
    coroutineContext: CoroutineContext = EmptyCoroutineContext,
    lifecycle: Lifecycle? = null,
): Recomposer
```


Create a `Lifecycle` and `window attachment`-aware `Recomposer` for this
`View` with the same behavior as `WindowRecomposerFactory.LifecycleAware`.

`coroutineContext` will override any `CoroutineContext` elements from the default configuration
normally used for this content view. The default `CoroutineContext` contains
`AndroidUiDispatcher.CurrentThread`; this function should only be called from the UI thread of
this `View` or its intended UI thread if it is currently detached.

If `lifecycle` is `null` or not supplied the `LifecycleOwner` returned by
`findViewTreeLifecycleOwner` will be used; if a non-null `lifecycle` is not provided and a
ViewTreeLifecycleOwner is not present an `IllegalStateException` will be thrown.

The returned `Recomposer` will be `cancelled` when this `View` is detached
from a window or if its determined `Lifecycle` is `destroyed`.
Recomposition and associated `frame-based` effects may be throttled or
paused while the `Lifecycle` is not at least `Lifecycle.State.STARTED`.