[android-components](../index.md) / [mozilla.components.lib.state.ext](./index.md)

## Package mozilla.components.lib.state.ext

### Extensions for External Classes

| Name | Summary |
|---|---|
| [androidx.fragment.app.Fragment](androidx.fragment.app.-fragment/index.md) |  |

### Functions

| Name | Summary |
|---|---|
| [channel](channel.md) | `fun <S : `[`State`](../mozilla.components.lib.state/-state.md)`, A : `[`Action`](../mozilla.components.lib.state/-action.md)`> `[`Store`](../mozilla.components.lib.state/-store/index.md)`<`[`S`](channel.md#S)`, `[`A`](channel.md#A)`>.channel(owner: LifecycleOwner = ProcessLifecycleOwner.get()): ReceiveChannel<`[`S`](channel.md#S)`>`<br>Creates a conflated [Channel](#) for observing [State](../mozilla.components.lib.state/-state.md) changes in the [Store](../mozilla.components.lib.state/-store/index.md). |
| [consumeFrom](consume-from.md) | `fun <S : `[`State`](../mozilla.components.lib.state/-state.md)`, A : `[`Action`](../mozilla.components.lib.state/-action.md)`> <ERROR CLASS>.consumeFrom(store: `[`Store`](../mozilla.components.lib.state/-store/index.md)`<`[`S`](consume-from.md#S)`, `[`A`](consume-from.md#A)`>, owner: LifecycleOwner, block: (`[`S`](consume-from.md#S)`) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Helper extension method for consuming [State](../mozilla.components.lib.state/-state.md) from a [Store](../mozilla.components.lib.state/-store/index.md) sequentially in order scoped to the lifetime of the [View](#). The [block](consume-from.md#mozilla.components.lib.state.ext$consumeFrom(, mozilla.components.lib.state.Store((mozilla.components.lib.state.ext.consumeFrom.S, mozilla.components.lib.state.ext.consumeFrom.A)), androidx.lifecycle.LifecycleOwner, kotlin.Function1((mozilla.components.lib.state.ext.consumeFrom.S, kotlin.Unit)))/block) function will get invoked for every [State](../mozilla.components.lib.state/-state.md) update. |
| [flow](flow.md) | `fun <S : `[`State`](../mozilla.components.lib.state/-state.md)`, A : `[`Action`](../mozilla.components.lib.state/-action.md)`> `[`Store`](../mozilla.components.lib.state/-store/index.md)`<`[`S`](flow.md#S)`, `[`A`](flow.md#A)`>.flow(owner: LifecycleOwner? = null): Flow<`[`S`](flow.md#S)`>`<br>Creates a [Flow](#) for observing [State](../mozilla.components.lib.state/-state.md) changes in the [Store](../mozilla.components.lib.state/-store/index.md). |
| [flowScoped](flow-scoped.md) | `fun <S : `[`State`](../mozilla.components.lib.state/-state.md)`, A : `[`Action`](../mozilla.components.lib.state/-action.md)`> `[`Store`](../mozilla.components.lib.state/-store/index.md)`<`[`S`](flow-scoped.md#S)`, `[`A`](flow-scoped.md#A)`>.flowScoped(owner: LifecycleOwner? = null, block: suspend (Flow<`[`S`](flow-scoped.md#S)`>) -> `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`): CoroutineScope`<br>Launches a coroutine in a new [MainScope](#) and creates a [Flow](#) for observing [State](../mozilla.components.lib.state/-state.md) changes in the [Store](../mozilla.components.lib.state/-store/index.md) in that scope. Invokes [block](flow-scoped.md#mozilla.components.lib.state.ext$flowScoped(mozilla.components.lib.state.Store((mozilla.components.lib.state.ext.flowScoped.S, mozilla.components.lib.state.ext.flowScoped.A)), androidx.lifecycle.LifecycleOwner, kotlin.SuspendFunction1((kotlinx.coroutines.flow.Flow((mozilla.components.lib.state.ext.flowScoped.S)), kotlin.Unit)))/block) inside that scope and passes the [Flow](#) to it. |
| [observe](observe.md) | `fun <S : `[`State`](../mozilla.components.lib.state/-state.md)`, A : `[`Action`](../mozilla.components.lib.state/-action.md)`> `[`Store`](../mozilla.components.lib.state/-store/index.md)`<`[`S`](observe.md#S)`, `[`A`](observe.md#A)`>.observe(owner: LifecycleOwner, observer: `[`Observer`](../mozilla.components.lib.state/-observer.md)`<`[`S`](observe.md#S)`>): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Registers an [Observer](../mozilla.components.lib.state/-observer.md) function that will be invoked whenever the state changes. The [Store.Subscription](../mozilla.components.lib.state/-store/-subscription/index.md) will be bound to the passed in [LifecycleOwner](#). Once the [Lifecycle](#) state changes to DESTROYED the [Observer](../mozilla.components.lib.state/-observer.md) will be unregistered automatically.`fun <S : `[`State`](../mozilla.components.lib.state/-state.md)`, A : `[`Action`](../mozilla.components.lib.state/-action.md)`> `[`Store`](../mozilla.components.lib.state/-store/index.md)`<`[`S`](observe.md#S)`, `[`A`](observe.md#A)`>.observe(view: <ERROR CLASS>, observer: `[`Observer`](../mozilla.components.lib.state/-observer.md)`<`[`S`](observe.md#S)`>): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Registers an [Observer](../mozilla.components.lib.state/-observer.md) function that will be invoked whenever the state changes. The [Store.Subscription](../mozilla.components.lib.state/-store/-subscription/index.md) will be bound to the passed in [View](#). Once the [View](#) gets detached the [Observer](../mozilla.components.lib.state/-observer.md) will be unregistered automatically. |
| [observeForever](observe-forever.md) | `fun <S : `[`State`](../mozilla.components.lib.state/-state.md)`, A : `[`Action`](../mozilla.components.lib.state/-action.md)`> `[`Store`](../mozilla.components.lib.state/-store/index.md)`<`[`S`](observe-forever.md#S)`, `[`A`](observe-forever.md#A)`>.observeForever(observer: `[`Observer`](../mozilla.components.lib.state/-observer.md)`<`[`S`](observe-forever.md#S)`>): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Registers an [Observer](../mozilla.components.lib.state/-observer.md) function that will observe the store indefinitely. |
