Home / Function/ onDestroy() — svelte Function Reference

onDestroy() — svelte Function Reference

Architecture documentation for the onDestroy() function in index-client.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  bf9532b7_3ab4_e735_2565_8aee52926f7b["onDestroy()"]
  717fc8d5_bdb4_4b73_d6c5_c4a367a60cf2["index-client.js"]
  bf9532b7_3ab4_e735_2565_8aee52926f7b -->|defined in| 717fc8d5_bdb4_4b73_d6c5_c4a367a60cf2
  12342fb2_7ca7_b519_b701_5203cbd52362["onMount()"]
  bf9532b7_3ab4_e735_2565_8aee52926f7b -->|calls| 12342fb2_7ca7_b519_b701_5203cbd52362
  a814b193_e12a_4037_c3c8_dfd45f3bd0bb["untrack()"]
  bf9532b7_3ab4_e735_2565_8aee52926f7b -->|calls| a814b193_e12a_4037_c3c8_dfd45f3bd0bb
  style bf9532b7_3ab4_e735_2565_8aee52926f7b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/index-client.js lines 115–121

export function onDestroy(fn) {
	if (component_context === null) {
		e.lifecycle_outside_component('onDestroy');
	}

	onMount(() => () => untrack(fn));
}

Subdomains

Frequently Asked Questions

What does onDestroy() do?
onDestroy() is a function in the svelte codebase, defined in packages/svelte/src/index-client.js.
Where is onDestroy() defined?
onDestroy() is defined in packages/svelte/src/index-client.js at line 115.
What does onDestroy() call?
onDestroy() calls 2 function(s): onMount, untrack.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free