You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md
+4-6Lines changed: 4 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -245,12 +245,12 @@ Note that you can still use `export const` and `export function` to expose thing
245
245
246
246
The `$inspect` rune is roughly equivalent to `console.log`, with the exception that it will re-run whenever its
247
247
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=))
249
249
250
250
```svelte
251
251
<script>
252
252
let count = $state(0);
253
-
let message = $state(0);
253
+
let message = $state('hello');
254
254
255
255
$inspect({ count, message }); // will console.log when `count` or `message` change
256
256
</script>
@@ -260,17 +260,15 @@ or array using [fine-grained reactivity](/docs/fine-grained-reactivity) will cau
260
260
```
261
261
262
262
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=)
264
264
265
265
```svelte
266
266
<script>
267
267
let count = $state(0);
268
268
269
269
$inspect(count, (count, type) => {
270
270
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
0 commit comments