use:disconnected
Element attribute that runs its callback just before the element is removed from the document. Useful for tearing down non-reactive subscriptions tied to the live DOM — for reactive-scope teardown, prefer cleanup. Accepts a single callback or an array of callbacks.
# Arguments
| name | type | description |
|---|---|---|
| fn | fn | function to run just before the Element is removed from the document |
# Snippet
# Test
Show when the elements are about to be removed from the document