aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Tools/tool.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Tools/tool.ts')
-rw-r--r--src/lib/Tools/tool.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/Tools/tool.ts b/src/lib/Tools/tool.ts
new file mode 100644
index 00000000..2d1a13f5
--- /dev/null
+++ b/src/lib/Tools/tool.ts
@@ -0,0 +1,15 @@
+import { browser } from '$app/environment';
+import { page } from '$app/stores';
+
+export const clearAllParameters = (saved: string[] = []) => {
+ if (browser) {
+ page.subscribe((value) => {
+ value.url.searchParams.forEach((_, key) => {
+ if (!saved.includes(key) && key !== 'tool') {
+ value.url.searchParams.delete(key);
+ }
+ });
+ history.replaceState(null, '', `?${value.url.searchParams.toString()}`);
+ });
+ }
+};