# BrowserInput

Artifact: [androidx.navigationevent:navigationevent](https://developer.android.com/jetpack/androidx/releases/navigationevent) [View Source](https://cs.android.com/search?q=file:androidx/navigationevent/BrowserInput.wasmJs.kt+class:androidx.navigationevent.BrowserInput) Common/AllAndroid/JVMJavaScript
- JS

  ```
  @ExperimentalNavigationEventApi
  class BrowserInput : NavigationEventInput
  ```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.navigationevent.NavigationEventInput](https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput) ||
|   | ↳ | [androidx.navigationevent.BrowserInput](https://developer.android.com/reference/kotlin/androidx/navigationevent/BrowserInput) |

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput` that translates browser history navigation events (popstate) into `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` events.

This implementation uses the browser's History API to synchronize the application's internal navigation state with the browser's history stack.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/navigationevent/BrowserInput#BrowserInput(org.w3c.dom.Window,kotlinx.coroutines.CoroutineDispatcher)(window: https://kotlinlang.org/api/core/kotlin-stdlib/org.w3c.dom/-window/index.html, coroutineDispatcher: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html)` Creates a `https://developer.android.com/reference/kotlin/androidx/navigationevent/BrowserInput` for the given `https://developer.android.com/reference/kotlin/androidx/navigationevent/BrowserInput#(org.w3c.dom.Window,kotlinx.coroutines.CoroutineDispatcher)`. | JS |

| ### Protected functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/BrowserInput#onAdded(androidx.navigationevent.NavigationEventDispatcher)(dispatcher: https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher)` Called after this `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput` is added to `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#onAdded(androidx.navigationevent.NavigationEventDispatcher)`. | JS |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/BrowserInput#onHistoryChanged(androidx.navigationevent.NavigationEventHistory)(history: https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventHistory)` Called when the `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventHistory` state in the connected `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` changes. | JS |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigationevent/BrowserInput#onRemoved()()` Called after this `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput` is removed from a `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher`. | JS |

### Inherited functions

From [androidx.navigationevent.NavigationEventInput](https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#dispatchOnBackCancelled()()`

Notifies the dispatcher that the ongoing `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventTransitionState#TRANSITIONING_BACK()` navigation gesture has been **cancelled**.
JS `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#dispatchOnBackCompleted()()`

Notifies the dispatcher that the ongoing `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventTransitionState#TRANSITIONING_BACK()` navigation gesture has **completed**.
JS `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#dispatchOnBackProgressed(androidx.navigationevent.NavigationEvent)(event: https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent)`

Notifies the dispatcher that an ongoing `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventTransitionState#TRANSITIONING_BACK()` navigation gesture has **progressed**.
JS `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#dispatchOnBackStarted(androidx.navigationevent.NavigationEvent)(event: https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent)`

Notifies the dispatcher that a `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventTransitionState#TRANSITIONING_BACK()` navigation gesture has **started**.
JS `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#dispatchOnForwardCancelled()()`

Notifies the dispatcher that the ongoing `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventTransitionState#TRANSITIONING_FORWARD()` navigation gesture has been **cancelled**.
JS `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#dispatchOnForwardCompleted()()`

Notifies the dispatcher that the ongoing `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventTransitionState#TRANSITIONING_FORWARD()` navigation gesture has **completed**.
JS `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#dispatchOnForwardProgressed(androidx.navigationevent.NavigationEvent)(event: https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent)`

Notifies the dispatcher that an ongoing `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventTransitionState#TRANSITIONING_FORWARD()` navigation gesture has **progressed**.
JS `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#dispatchOnForwardStarted(androidx.navigationevent.NavigationEvent)(event: https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEvent)`

Notifies the dispatcher that a `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventTransitionState#TRANSITIONING_FORWARD()` navigation gesture has **started**.
JS `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
@https://developer.android.com/reference/kotlin/androidx/annotation/EmptySuper
https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#onHasEnabledBackHandlersChanged(kotlin.Boolean)(hasEnabledBackHandlers: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called when the enabled state of back handlers in the connected `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` changes.
JS `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
@https://developer.android.com/reference/kotlin/androidx/annotation/EmptySuper
https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#onHasEnabledForwardHandlersChanged(kotlin.Boolean)(hasEnabledForwardHandlers: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called when the enabled state of forward handlers in the connected `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` changes.
JS `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
@https://developer.android.com/reference/kotlin/androidx/annotation/EmptySuper
https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#onHasEnabledHandlersChanged(kotlin.Boolean)(hasEnabledHandlers: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called when the enabled state of handlers (either back or forward) in the connected `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` changes.
JS

### Inherited properties

From [androidx.navigationevent.NavigationEventInput](https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#hasEnabledBackHandlers()`

Tracks whether the connected `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` has any enabled `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventHandler` for back navigation matching this input's priority scope.
JS `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#hasEnabledForwardHandlers()`

Tracks whether the connected `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` has any enabled `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventHandler` for forward navigation matching this input's priority scope.
JS `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#hasEnabledHandlers()`

Tracks whether the connected `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` has any enabled `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventHandler` matching this input's priority scope.
JS

## Public constructors

### BrowserInput

JS

```
BrowserInput(
    window: Window,
    coroutineDispatcher: CoroutineDispatcher = Dispatchers.Main
)
```

Creates a `https://developer.android.com/reference/kotlin/androidx/navigationevent/BrowserInput` for the given `https://developer.android.com/reference/kotlin/androidx/navigationevent/BrowserInput#(org.w3c.dom.Window,kotlinx.coroutines.CoroutineDispatcher)`.

## Protected functions

### onAdded

JS

```
protected open fun onAdded(dispatcher: NavigationEventDispatcher): Unit
```

Called after this `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput` is added to `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput#onAdded(androidx.navigationevent.NavigationEventDispatcher)`. This can happen when calling `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher#addInput(androidx.navigationevent.NavigationEventInput)`. A `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput` can only be added to one `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` at a time.

| Parameters |
|---|---|
| `dispatcher: https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` | The `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` that this input is now added to. |

### onHistoryChanged

JS

```
protected open fun onHistoryChanged(history: NavigationEventHistory): Unit
```

Called when the `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventHistory` state in the connected `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher` changes.

| Parameters |
|---|---|
| `history: https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventHistory` | The new, immutable snapshot of the navigation history. |

### onRemoved

JS

```
protected open fun onRemoved(): Unit
```

Called after this `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInput` is removed from a `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher`. This can happen when calling `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher#removeInput(androidx.navigationevent.NavigationEventInput)` or `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher#dispose()` on the containing `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventDispatcher`.