@neovici/cosmoz-utils 6.20.0 → 6.20.2
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/dist/haunted-polymer.js +2 -0
- package/dist/location.d.ts +3 -1
- package/dist/location.js +4 -2
- package/package.json +1 -1
package/dist/haunted-polymer.js
CHANGED
|
@@ -36,10 +36,12 @@ export const hauntedPolymer = (outputPath, hook) => (base) => {
|
|
|
36
36
|
}
|
|
37
37
|
connectedCallback() {
|
|
38
38
|
super.connectedCallback();
|
|
39
|
+
this._scheduler.resume();
|
|
39
40
|
this._scheduler.update();
|
|
40
41
|
}
|
|
41
42
|
disconnectedCallback() {
|
|
42
43
|
super.disconnectedCallback();
|
|
44
|
+
this._scheduler.pause();
|
|
43
45
|
this._scheduler.teardown();
|
|
44
46
|
}
|
|
45
47
|
_propertiesChanged(currentProps, changedProps, oldProps) {
|
package/dist/location.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export declare const hashUrl: () => URL
|
|
1
|
+
export declare const hashUrl: () => URL;
|
|
2
|
+
export declare const singleParse: <T = string>(hashParam: string, codec?: (value: string) => T) => T | T[] | undefined;
|
|
3
|
+
export declare const multiParse: <T = string>(hashParam: string, codec?: (entry: [string, string]) => [string, T]) => Record<string, T>;
|
package/dist/location.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { identity } from './function';
|
|
2
|
-
export const hashUrl = () => new URL(location.hash.replace(/^#!?/iu, '').replace('%23', '#'), location.origin)
|
|
2
|
+
export const hashUrl = () => new URL(location.hash.replace(/^#!?/iu, '').replace('%23', '#'), location.origin);
|
|
3
|
+
export const singleParse = (hashParam, codec = identity) => {
|
|
3
4
|
const values = new URLSearchParams(hashUrl().hash.replace('#', '')).getAll(hashParam);
|
|
4
5
|
switch (values.length) {
|
|
5
6
|
case 0:
|
|
@@ -9,7 +10,8 @@ export const hashUrl = () => new URL(location.hash.replace(/^#!?/iu, '').replace
|
|
|
9
10
|
default:
|
|
10
11
|
return values.map(codec);
|
|
11
12
|
}
|
|
12
|
-
}
|
|
13
|
+
};
|
|
14
|
+
export const multiParse = (hashParam, codec = identity) => {
|
|
13
15
|
const params = Array.from(new URLSearchParams(hashUrl().hash.replace('#', '')).entries())
|
|
14
16
|
.filter(([param]) => param.startsWith(hashParam))
|
|
15
17
|
.map(([param, value]) => codec([param.replace(hashParam, ''), value]))
|