use:connected
Element attribute that runs its callback once the element is connected to the document. Available only as an attribute on elements (not as a standalone lifecycle — that's ready). Accepts a single callback or an array of callbacks.
use:connected callbacks run after the current batch of nodes has been inserted into the document, before paint, in recursive order, and before the ready callbacks.
If work scheduled from the callback runs in parallel with other reactive updates, pass the callback a signal so the value stays in sync and you avoid race conditions.
# Arguments
| name | type | description |
|---|---|---|
| fn | fn | function to run once the Element is connected to the document |
# Snippet
# Timing
Displays current timings of ready vs connected