From 17746ca0ee8004ed97553c8517c605d43c5a8b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Wenzel?= Date: Wed, 10 Oct 2018 00:32:40 +0200 Subject: [PATCH] feat(history) add go method The go method moves to a specific position in the navigation history. --- src/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index b15b634..2b8d564 100644 --- a/src/index.js +++ b/src/index.js @@ -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 { @@ -218,6 +218,15 @@ export class BrowserHistory extends History { return historyIndex; } + /** + * Move to a specific position in the navigation history. + * @param movement The amount of steps, positive or negativ, to move. + * @returns The current index. + */ + go(movement: number): void { + this.history.go(movement); + } + _getHash(): string { return this.location.hash.substr(1); }