Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sveltekit-search-params

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sveltekit-search-params - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "sveltekit-search-params",
"version": "1.0.2",
"version": "1.0.3",
"repository": "git+https://github.com/paoloricciuti/sveltekit-search-params.git",

@@ -5,0 +5,0 @@ "author": "Paolo Ricciuti",

/* eslint-disable @typescript-eslint/no-empty-function */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { writable, get } from 'svelte/store';
import { goto } from '$app/navigation';
import { goto, afterNavigate } from '$app/navigation';
import { page } from '$app/stores';

@@ -106,2 +106,8 @@ import { browser } from '$app/environment';

export function queryParameters(options, { debounceHistory = 0, pushHistory = true, } = {}) {
let pushHistoryCb = null;
afterNavigate(() => {
if (pushHistoryCb) {
pushHistoryCb();
}
});
const { set: _set, subscribe } = writable();

@@ -136,5 +142,6 @@ const setRef = { value: noop };

debouncedTimeouts.set("queryParameters", setTimeout(() => {
const updatedPage = get(page);
const updatedQuery = new URLSearchParams(updatedPage.url.searchParams);
goto(`?${updatedQuery.toString()}`, GOTO_OPTIONS_PUSH);
pushHistoryCb = () => {
goto("", GOTO_OPTIONS_PUSH);
pushHistoryCb = null;
};
}, debounceHistory));

@@ -177,2 +184,8 @@ }

export function queryParam(name, { encode: encode = DEFAULT_ENCODER_DECODER.encode, decode: decode = DEFAULT_ENCODER_DECODER.decode, defaultValue } = DEFAULT_ENCODER_DECODER, { debounceHistory = 0, pushHistory = true, } = {}) {
let pushHistoryCb = null;
afterNavigate(() => {
if (pushHistoryCb) {
pushHistoryCb();
}
});
const { set: _set, subscribe } = writable();

@@ -202,5 +215,6 @@ const setRef = { value: noop };

debouncedTimeouts.set(name, setTimeout(() => {
const updatedPage = get(page);
const updatedQuery = new URLSearchParams(updatedPage.url.searchParams);
goto(`?${updatedQuery.toString()}`, GOTO_OPTIONS_PUSH);
pushHistoryCb = () => {
goto("", GOTO_OPTIONS_PUSH);
pushHistoryCb = null;
};
}, debounceHistory));

@@ -207,0 +221,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc