# WindowRecomposerFactory

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/platform/WindowRecomposer.android.kt+class:androidx.compose.ui.platform.WindowRecomposerFactory) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- android

  ```
  @InternalComposeUiApi
  fun interface WindowRecomposerFactory
  ```

*** ** * ** ***

A factory for creating an Android window-scoped `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer`. See `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/WindowRecomposerFactory#createRecomposer(android.view.View)`.

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/WindowRecomposerFactory` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/WindowRecomposerFactory#LifecycleAware()` A `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/WindowRecomposerFactory` that creates **lifecycle-aware** `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer`s. | android |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/WindowRecomposerFactory#createRecomposer(android.view.View)(windowRootView: https://developer.android.com/reference/android/view/View.html)` Get a `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer` for the window where `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/WindowRecomposerFactory#createRecomposer(android.view.View)` is at the root of the window's `https://developer.android.com/reference/android/view/View.html` hierarchy. | android |

## Public companion properties

### LifecycleAware

android Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val LifecycleAware: WindowRecomposerFactory
```

A `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/WindowRecomposerFactory` that creates **lifecycle-aware** `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer`s.

Returned `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer`s will be bound to the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` returned by `https://developer.android.com/reference/kotlin/androidx/lifecycle/package-summary#(android.view.View).findViewTreeLifecycleOwner()` registered at the `https://developer.android.com/reference/android/view/View.html#getRootView()` of the view hierarchy and run `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer#runRecomposeAndApplyChanges()` and composition effects on the `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#CurrentThread()` for the window's UI thread. The associated `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock` will only produce frames when the `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle` is at least `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.State#STARTED`, causing animations and other uses of `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock` APIs to suspend until a **visible** frame will be produced.

## Public functions

### createRecomposer

android Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun createRecomposer(windowRootView: View): Recomposer
```

Get a `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer` for the window where `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/WindowRecomposerFactory#createRecomposer(android.view.View)` is at the root of the window's `https://developer.android.com/reference/android/view/View.html` hierarchy. The factory is responsible for establishing a policy for `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer#cancel()` the returned `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer`. `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/WindowRecomposerFactory#createRecomposer(android.view.View)` will hold a hard reference to the returned `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer` until it `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Recomposer#join()` after shutting down.