summaryrefslogtreecommitdiffstats
path: root/VegaData/wwwroot/framework.js
diff options
context:
space:
mode:
Diffstat (limited to 'VegaData/wwwroot/framework.js')
-rw-r--r--VegaData/wwwroot/framework.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/VegaData/wwwroot/framework.js b/VegaData/wwwroot/framework.js
index e1652d0..de20d66 100644
--- a/VegaData/wwwroot/framework.js
+++ b/VegaData/wwwroot/framework.js
@@ -72,7 +72,7 @@ function trigger(target, key) {
// To use this in element props you need to supply the .value read as a function.
// */
export function r(target) {
- target = {value: target};
+ target = { value: target };
return new Proxy(target, {
get(obj, key, receiver) {
track(obj, key);
@@ -109,6 +109,24 @@ export function e(fn) {
return runner;
}
+export function gqp(key) {
+ return new URLSearchParams(location.search).get(key)
+}
+
+export function sqp(query) {
+ console.log(query);
+
+ if ('URLSearchParams' in window) {
+ const url = new URL(window.location)
+ for (const key of Object.keys(query)) {
+ const value = encodeURIComponent(query[key])
+ if (!value || value === "") url.searchParams.delete(key)
+ else url.searchParams.set(key, value)
+ }
+ history.pushState(null, '', url);
+ }
+}
+
//**
// Combine elements
// */
@@ -144,7 +162,7 @@ export function css(styleObject) {
// */
export function t(name, props, ...children) {
if (typeof name === "function") {
- return name({...props, children});
+ return name({ ...props, children });
}
return createElement(name, props, children);
}