Skip to content

Commit 2016320

Browse files
committed
demos
1 parent af017da commit 2016320

File tree

1 file changed

+4
-6
lines changed
  • sites/svelte-5-preview/src/routes/docs/content/01-api

1 file changed

+4
-6
lines changed

sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,12 @@ Note that you can still use `export const` and `export function` to expose thing
245245

246246
The `$inspect` rune is roughly equivalent to `console.log`, with the exception that it will re-run whenever its
247247
argument changes. `$inspect` tracks reactive state deeply, meaning that updating something inside an object
248-
or array using [fine-grained reactivity](/docs/fine-grained-reactivity) will cause it to re-fire.
248+
or array using [fine-grained reactivity](/docs/fine-grained-reactivity) will cause it to re-fire. ([Demo:](/#H4sIAAAAAAAAE0WQ0W6DMAxFf8WKKhXUquyZAtIe9w1lEjS4ENU4EXFaTRH_Plq69fH6nutrOaqLIfQqP0XF7YgqV5_Oqb2SH_cQ_oYkuGhvw6Qfk8LryTipaq6FUEDbwAIlbLy0gslHevxzRvS-7fHtbQckstsnsTAbw96hliSuS_b_iTk9QpbB3RAtFntLeCDbw31AhuYJN2AnaF6BBvTQco81F9n7PC7OQcQyWNZk9LWMSQpltZbtdnP1xXrCEVmKbCWXVGHYBYGz4S6_tRSwjK-SGbJqecRoO3Mx2KlcpoDz9_wLBx9LikMBAAA=))
249249

250250
```svelte
251251
<script>
252252
let count = $state(0);
253-
let message = $state(0);
253+
let message = $state('hello');
254254
255255
$inspect({ count, message }); // will console.log when `count` or `message` change
256256
</script>
@@ -260,17 +260,15 @@ or array using [fine-grained reactivity](/docs/fine-grained-reactivity) will cau
260260
```
261261

262262
If a callback is also provided, it will be invoked instead of `console.log`. The first argument to the callback
263-
is the current value. The second is either `"init"` or `"update"`.
263+
is the current value. The second is either `"init"` or `"update"`. [Demo:](/#H4sIAAAAAAAAE0VP24qDMBD9lSEUqlTqPlsj7ON-w1qojWM3rE5CMmkpkn_fxFL26XBuw5lVTHpGL5rvVdCwoGjEp7WiEvy0mfg7zoyJexOcykrrldOWu556npFBmUAMEnaeB8biozwlJ3k7Td6i4mILVPDGfLgE2cGaUz3rCYqsgZQS9sGO6cq-fLs9j3gNtxu6E9Q1GAcXZcibGY_sBoWXKmuPn1S6o4OnCfAYiF_lmCHmQW39v5raa2A2BIbUrNWvXIttz7bvcIjdFymHCxK39SvZpf8XM-pJ4ygadgHjOf4B8TXIiDoBAAA=)
264264

265265
```svelte
266266
<script>
267267
let count = $state(0);
268268
269269
$inspect(count, (count, type) => {
270270
if (type === 'update') {
271-
// or `console.trace`, or whatever you want. This makes it
272-
// easy to find what caused the state to update
273-
debugger;
271+
debugger; // or `console.trace`, or whatever you want
274272
}
275273
});
276274
</script>

0 commit comments

Comments
 (0)