From 51082f693348a1bb5e1d4d9921f427109416a009 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Thu, 14 Mar 2024 12:49:04 +0000 Subject: [PATCH] add docs --- packages/svelte/src/internal/client/proxy.js | 1 - .../routes/docs/content/01-api/02-runes.md | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/svelte/src/internal/client/proxy.js b/packages/svelte/src/internal/client/proxy.js index 801cd5c15e..198e16f939 100644 --- a/packages/svelte/src/internal/client/proxy.js +++ b/packages/svelte/src/internal/client/proxy.js @@ -48,7 +48,6 @@ export function proxy(value, immutable = true, owners) { const prototype = get_prototype_of(value); - // TODO handle Map and Set as well if (prototype === object_prototype || prototype === array_prototype) { const proxy = new Proxy(value, state_proxy_handler); diff --git a/sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md b/sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md index 7cb20245ff..839b0a373f 100644 --- a/sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md +++ b/sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md @@ -93,6 +93,25 @@ This can improve performance with large arrays and objects that you weren't plan > Objects and arrays passed to `$state.frozen` will be shallowly frozen using `Object.freeze()`. If you don't want this, pass in a clone of the object or array instead. +### Reactive Map, Set and Date + +Svelte provides reactive wrappers for the native `Map`, `Set` and `Date` objects. These can be found imported from `svelte/reactivity` and used just like their native equivalents. + +```svelte + + +

{map.get('message')}

+``` + ## `$derived` Derived state is declared with the `$derived` rune: