@lexriver/dome 1.5.5 → 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/DomeRouter.js +4 -4
- package/package.json +1 -1
- package/src/DomeRouter.ts +4 -4
package/out/DomeRouter.js
CHANGED
|
@@ -16,9 +16,9 @@ export var DomeRouter;
|
|
|
16
16
|
//console.log(filename, 'window.popstate event', e, 'historyUrls=', historyUrls)
|
|
17
17
|
const url = window.location.pathname;
|
|
18
18
|
await executeAsync(url, getScrollPositionForUrl(url));
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
await DomeManipulator.scrollToAsync({
|
|
20
|
+
pxFromTop: getScrollPositionForUrl(window.location.pathname)
|
|
21
|
+
});
|
|
22
22
|
});
|
|
23
23
|
function getScrollPositionForUrl(url) {
|
|
24
24
|
return scrollPositionByUrl.get(url) ?? 0;
|
|
@@ -30,6 +30,7 @@ export var DomeRouter;
|
|
|
30
30
|
scrollPositionByUrl.set(getCurrentUrl(), DomeManipulator.getCurrentScrollPosition());
|
|
31
31
|
}
|
|
32
32
|
function navigate(url) {
|
|
33
|
+
saveScrollPositionForCurrentUrl();
|
|
33
34
|
window.history.pushState(null, '', url);
|
|
34
35
|
executeAsync(url, 0);
|
|
35
36
|
DomeManipulator.scrollToTop();
|
|
@@ -182,7 +183,6 @@ export var DomeRouter;
|
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
async function executeAsync(url = window.location.pathname, scrollToPosition) {
|
|
185
|
-
saveScrollPositionForUrl(url);
|
|
186
186
|
//const url = window.location.pathname
|
|
187
187
|
const urlSlices = getRouteSlices(url);
|
|
188
188
|
// urlSlices = show, category, 345
|
package/package.json
CHANGED
package/src/DomeRouter.ts
CHANGED
|
@@ -32,9 +32,9 @@ export module DomeRouter {
|
|
|
32
32
|
const url = window.location.pathname
|
|
33
33
|
await executeAsync(url, getScrollPositionForUrl(url) )
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
await DomeManipulator.scrollToAsync({
|
|
36
|
+
pxFromTop: getScrollPositionForUrl(window.location.pathname)
|
|
37
|
+
})
|
|
38
38
|
})
|
|
39
39
|
|
|
40
40
|
function getScrollPositionForUrl(url:string){
|
|
@@ -50,6 +50,7 @@ export module DomeRouter {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export function navigate(url:string){
|
|
53
|
+
saveScrollPositionForCurrentUrl()
|
|
53
54
|
window.history.pushState(null, '', url)
|
|
54
55
|
executeAsync(url, 0)
|
|
55
56
|
DomeManipulator.scrollToTop()
|
|
@@ -213,7 +214,6 @@ export module DomeRouter {
|
|
|
213
214
|
}
|
|
214
215
|
|
|
215
216
|
async function executeAsync(url:string = window.location.pathname, scrollToPosition:number){
|
|
216
|
-
saveScrollPositionForUrl(url)
|
|
217
217
|
//const url = window.location.pathname
|
|
218
218
|
const urlSlices = getRouteSlices(url)
|
|
219
219
|
// urlSlices = show, category, 345
|