Interface: BrowserHistory
API / @xmachines/play-dom-router / BrowserHistory
Defined in: play-dom-router/src/create-browser-history.ts:1
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
location | readonly | object | Returns the state of the current location | play-dom-router/src/create-browser-history.ts:5 |
location.hash | public | string | - | play-dom-router/src/create-browser-history.ts:8 |
location.pathname | public | string | - | play-dom-router/src/create-browser-history.ts:6 |
location.search | public | string | - | play-dom-router/src/create-browser-history.ts:7 |
location.state | public | unknown | - | play-dom-router/src/create-browser-history.ts:9 |
Methods
back()
back(): void;Defined in: play-dom-router/src/create-browser-history.ts:26
Returns
void
createHref()
createHref(path): string;Defined in: play-dom-router/src/create-browser-history.ts:38
Creates an href from a path
Parameters
| Parameter | Type |
|---|---|
path | string |
Returns
string
destroy()
destroy(): void;Defined in: play-dom-router/src/create-browser-history.ts:46
Cleans up.
A second call is safe. When more than one wrapper shares the same
window.history, the last wrapper restores the original methods.
Returns
void
forward()
forward(): void;Defined in: play-dom-router/src/create-browser-history.ts:27
Returns
void
go()
go(delta): void;Defined in: play-dom-router/src/create-browser-history.ts:25
Moves back or forward in the history
Parameters
| Parameter | Type |
|---|---|
delta | number |
Returns
void
push()
push(path, state?): void;Defined in: play-dom-router/src/create-browser-history.ts:15
Pushes a new URL to the history
Parameters
| Parameter | Type |
|---|---|
path | string |
state? | unknown |
Returns
void
replace()
replace(path, state?): void;Defined in: play-dom-router/src/create-browser-history.ts:20
Replaces the current URL in the history
Parameters
| Parameter | Type |
|---|---|
path | string |
state? | unknown |
Returns
void
subscribe()
subscribe(listener): () => void;Defined in: play-dom-router/src/create-browser-history.ts:33
Subscribes to the history changes. It returns a function that cancels the subscription
Parameters
| Parameter | Type |
|---|---|
listener | (location) => void |
Returns
() => void