svelte/reactivity
Svelte provides reactive versions of various built-ins like SvelteMap
, SvelteSet
and SvelteURL
. These can be imported from svelte/reactivity
and used just like their native counterparts.
<script>
import { SvelteURL } from 'svelte/reactivity';
const url = new SvelteURL('https://example.com/path');
</script>
<!-- changes to these... -->
<input bind:value={url.protocol} />
<input bind:value={url.hostname} />
<input bind:value={url.pathname} />
<hr />
<!-- will update `href` and vice versa -->
<input bind:value={url.href} />
SvelteDate
class SvelteDate extends Date {…}
constructor(...params: any[]);
#private;
SvelteMap
class SvelteMap<K, V> extends Map<K, V> {…}
constructor(value?: Iterable<readonly [K, V]> | null | undefined);
set(key: K, value: V): this;
#private;
SvelteSet
class SvelteSet<T> extends Set<T> {…}
constructor(value?: Iterable<T> | null | undefined);
add(value: T): this;
#private;
SvelteURL
class SvelteURL extends URL {…}
get searchParams(): SvelteURLSearchParams;
#private;
SvelteURLSearchParams
class SvelteURLSearchParams extends URLSearchParams {…}
[REPLACE](params: URLSearchParams): void;
#private;
previous next