[android-components](../../index.md) / [mozilla.components.browser.state.store](../index.md) / [BrowserStore](./index.md)

# BrowserStore

`class BrowserStore : `[`Store`](../../mozilla.components.lib.state/-store/index.md)`<`[`BrowserState`](../../mozilla.components.browser.state.state/-browser-state/index.md)`, `[`BrowserAction`](../../mozilla.components.browser.state.action/-browser-action.md)`>` [(source)](https://github.com/mozilla-mobile/android-components/blob/master/components/browser/state/src/main/java/mozilla/components/browser/state/store/BrowserStore.kt#L21)

The [BrowserStore](./index.md) holds the [BrowserState](../../mozilla.components.browser.state.state/-browser-state/index.md) (state tree).

The only way to change the [BrowserState](../../mozilla.components.browser.state.state/-browser-state/index.md) inside [BrowserStore](./index.md) is to dispatch an [Action](../../mozilla.components.lib.state/-action.md) on it.

### Constructors

| Name | Summary |
|---|---|
| [&lt;init&gt;](-init-.md) | `BrowserStore(initialState: `[`BrowserState`](../../mozilla.components.browser.state.state/-browser-state/index.md)` = BrowserState(), middleware: `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[`Middleware`](../../mozilla.components.lib.state/-middleware.md)`<`[`BrowserState`](../../mozilla.components.browser.state.state/-browser-state/index.md)`, `[`BrowserAction`](../../mozilla.components.browser.state.action/-browser-action.md)`>> = emptyList())`<br>The [BrowserStore](./index.md) holds the [BrowserState](../../mozilla.components.browser.state.state/-browser-state/index.md) (state tree). |

### Inherited Properties

| Name | Summary |
|---|---|
| [state](../../mozilla.components.lib.state/-store/state.md) | `val state: `[`S`](../../mozilla.components.lib.state/-store/index.md#S)<br>The current [State](../../mozilla.components.lib.state/-state.md). |

### Inherited Functions

| Name | Summary |
|---|---|
| [dispatch](../../mozilla.components.lib.state/-store/dispatch.md) | `fun dispatch(action: `[`A`](../../mozilla.components.lib.state/-store/index.md#A)`): Job`<br>Dispatch an [Action](../../mozilla.components.lib.state/-action.md) to the store in order to trigger a [State](../../mozilla.components.lib.state/-state.md) change. |
| [observeManually](../../mozilla.components.lib.state/-store/observe-manually.md) | `fun observeManually(observer: `[`Observer`](../../mozilla.components.lib.state/-observer.md)`<`[`S`](../../mozilla.components.lib.state/-store/index.md#S)`>): `[`Subscription`](../../mozilla.components.lib.state/-store/-subscription/index.md)`<`[`S`](../../mozilla.components.lib.state/-store/index.md#S)`, `[`A`](../../mozilla.components.lib.state/-store/index.md#A)`>`<br>Registers an [Observer](../../mozilla.components.lib.state/-observer.md) function that will be invoked whenever the [State](../../mozilla.components.lib.state/-state.md) changes. |

### Extension Functions

| Name | Summary |
|---|---|
| [channel](../../mozilla.components.lib.state.ext/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`](../../mozilla.components.lib.state.ext/channel.md#S)`, `[`A`](../../mozilla.components.lib.state.ext/channel.md#A)`>.channel(owner: LifecycleOwner = ProcessLifecycleOwner.get()): ReceiveChannel<`[`S`](../../mozilla.components.lib.state.ext/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). |
| [flow](../../mozilla.components.lib.state.ext/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`](../../mozilla.components.lib.state.ext/flow.md#S)`, `[`A`](../../mozilla.components.lib.state.ext/flow.md#A)`>.flow(owner: LifecycleOwner? = null): Flow<`[`S`](../../mozilla.components.lib.state.ext/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](../../mozilla.components.lib.state.ext/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`](../../mozilla.components.lib.state.ext/flow-scoped.md#S)`, `[`A`](../../mozilla.components.lib.state.ext/flow-scoped.md#A)`>.flowScoped(owner: LifecycleOwner? = null, block: suspend (Flow<`[`S`](../../mozilla.components.lib.state.ext/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](../../mozilla.components.lib.state.ext/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. |
| [loadResourceAsString](../../mozilla.components.support.test.file/kotlin.-any/load-resource-as-string.md) | `fun `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`.loadResourceAsString(path: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)<br>Loads a file from the resources folder and returns its content as a string object. |
| [observe](../../mozilla.components.lib.state.ext/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`](../../mozilla.components.lib.state.ext/observe.md#S)`, `[`A`](../../mozilla.components.lib.state.ext/observe.md#A)`>.observe(owner: LifecycleOwner, observer: `[`Observer`](../../mozilla.components.lib.state/-observer.md)`<`[`S`](../../mozilla.components.lib.state.ext/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`](../../mozilla.components.lib.state.ext/observe.md#S)`, `[`A`](../../mozilla.components.lib.state.ext/observe.md#A)`>.observe(view: <ERROR CLASS>, observer: `[`Observer`](../../mozilla.components.lib.state/-observer.md)`<`[`S`](../../mozilla.components.lib.state.ext/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](../../mozilla.components.lib.state.ext/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`](../../mozilla.components.lib.state.ext/observe-forever.md#S)`, `[`A`](../../mozilla.components.lib.state.ext/observe-forever.md#A)`>.observeForever(observer: `[`Observer`](../../mozilla.components.lib.state/-observer.md)`<`[`S`](../../mozilla.components.lib.state.ext/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. |
| [waitUntilIdle](../../mozilla.components.support.test.libstate.ext/wait-until-idle.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`](../../mozilla.components.support.test.libstate.ext/wait-until-idle.md#S)`, `[`A`](../../mozilla.components.support.test.libstate.ext/wait-until-idle.md#A)`>.waitUntilIdle(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Blocks and returns once all dispatched actions have been processed i.e. the reducers have run and all observers have been notified of state changes. |
