From 849faf2447e1d812c0c4b42bd9c3a8f53cd99c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Wenzel?= Date: Wed, 10 Oct 2018 00:58:37 +0200 Subject: [PATCH] feat(history) add go method The go method moves to a specific position in the navigation history. --- src/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index b15b634..72638ff 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,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); }