@lexriver/dome 1.5.0 → 1.5.1

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 CHANGED
@@ -17,13 +17,21 @@ export var DomeRouter;
17
17
  });
18
18
  function getScrollPositionForUrl(url) {
19
19
  // well, let's find the last url? or which index?
20
- let result = 0;
21
- for (let item of historyUrls) {
20
+ //let result = 0
21
+ for (let i = historyUrls.length - 1; i >= 0; i--) {
22
+ const item = historyUrls[i];
22
23
  if (item.url === url) {
23
- result = item.scroll;
24
+ //result = item.scroll
25
+ return item.scroll;
24
26
  }
25
27
  }
26
- return result;
28
+ return 0;
29
+ // for(let item of historyUrls){
30
+ // if(item.url === url){
31
+ // result = item.scroll
32
+ // }
33
+ // }
34
+ // return result
27
35
  }
28
36
  function navigate(url) {
29
37
  window.history.pushState(null, '', url);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "sideEffects": false,
4
4
  "name": "@lexriver/dome",
5
- "version": "1.5.0",
5
+ "version": "1.5.1",
6
6
  "description": "",
7
7
  "main": "out/index.js",
8
8
  "types": "out/index.d.ts",
package/src/DomeRouter.ts CHANGED
@@ -37,13 +37,22 @@ export module DomeRouter {
37
37
 
38
38
  function getScrollPositionForUrl(url:string){
39
39
  // well, let's find the last url? or which index?
40
- let result = 0
41
- for(let item of historyUrls){
40
+ //let result = 0
41
+ for(let i=historyUrls.length-1;i>=0;i--){
42
+ const item = historyUrls[i]
42
43
  if(item.url === url){
43
- result = item.scroll
44
+ //result = item.scroll
45
+ return item.scroll
46
+
44
47
  }
45
48
  }
46
- return result
49
+ return 0
50
+ // for(let item of historyUrls){
51
+ // if(item.url === url){
52
+ // result = item.scroll
53
+ // }
54
+ // }
55
+ // return result
47
56
  }
48
57
 
49
58
  export function navigate(url:string){