Skip to content

Commit

Permalink
feat(history) add go method
Browse files Browse the repository at this point in the history
The go method moves to a specific position in the navigation history.
  • Loading branch information
jwx committed Oct 9, 2018
1 parent ced1ce0 commit 849faf2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class BrowserHistory extends History {
}

/**
* Returns the current index in the history object.
* Returns the current index in the navigation history.
* @returns The current index.
*/
getHistoryIndex(): number {
Expand All @@ -218,6 +218,14 @@ export class BrowserHistory extends History {
return historyIndex;
}

/**
* Move to a specific position in the navigation history.
* @param movement The amount of steps, positive or negative, to move.
*/
go(movement: number): void {
this.history.go(movement);
}

_getHash(): string {
return this.location.hash.substr(1);
}
Expand Down

0 comments on commit 849faf2

Please sign in to comment.