We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a315abb commit e7d46c4Copy full SHA for e7d46c4
src/main.js
@@ -1,6 +1,6 @@
1
const storage = [];
2
3
-module.exports = ({ history, limit = 20 }) => ({
+module.exports = ({ history, reset = true, limit = 20 }) => ({
4
start: () => {
5
if(history.action === 'PUSH') {
6
storage.push([
@@ -18,8 +18,14 @@ module.exports = ({ history, limit = 20 }) => ({
18
19
if(history.action === 'POP' && storage.length) {
20
position = storage.pop();
21
+
22
+ window.scrollTo(...position);
23
+ } else {
24
+ const { location: { state } } = history;
25
26
+ if(reset || (state && state.resetScroll)) {
27
28
+ }
29
}
-
- window.scrollTo(...position);
30
-});
31
+});
0 commit comments