Home / Function/ component_root() — svelte Function Reference

component_root() — svelte Function Reference

Architecture documentation for the component_root() function in effects.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  0448eaeb_2934_f939_a81e_5b59a8c48202["component_root()"]
  1ae6fa4e_16ee_acdf_5e28_17eb0819fddb["effects.js"]
  0448eaeb_2934_f939_a81e_5b59a8c48202 -->|defined in| 1ae6fa4e_16ee_acdf_5e28_17eb0819fddb
  95c17f0f_1042_263c_3de2_f8ab899408b0["_mount()"]
  95c17f0f_1042_263c_3de2_f8ab899408b0 -->|calls| 0448eaeb_2934_f939_a81e_5b59a8c48202
  2ec0d2fd_8bbc_b2ba_53ae_f2da02bb3ba5["ensure()"]
  0448eaeb_2934_f939_a81e_5b59a8c48202 -->|calls| 2ec0d2fd_8bbc_b2ba_53ae_f2da02bb3ba5
  9764bb93_860c_6dee_2112_890b69ee0aa3["create_effect()"]
  0448eaeb_2934_f939_a81e_5b59a8c48202 -->|calls| 9764bb93_860c_6dee_2112_890b69ee0aa3
  27507f0c_dcab_c3a5_2ce6_5e4b1ef9df3d["pause_effect()"]
  0448eaeb_2934_f939_a81e_5b59a8c48202 -->|calls| 27507f0c_dcab_c3a5_2ce6_5e4b1ef9df3d
  410f774f_2d1a_7114_fcba_b292ed7cae3a["destroy_effect()"]
  0448eaeb_2934_f939_a81e_5b59a8c48202 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a
  style 0448eaeb_2934_f939_a81e_5b59a8c48202 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/internal/client/reactivity/effects.js lines 267–284

export function component_root(fn) {
	Batch.ensure();
	const effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn, true);

	return (options = {}) => {
		return new Promise((fulfil) => {
			if (options.outro) {
				pause_effect(effect, () => {
					destroy_effect(effect);
					fulfil(undefined);
				});
			} else {
				destroy_effect(effect);
				fulfil(undefined);
			}
		});
	};
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does component_root() do?
component_root() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/reactivity/effects.js.
Where is component_root() defined?
component_root() is defined in packages/svelte/src/internal/client/reactivity/effects.js at line 267.
What does component_root() call?
component_root() calls 4 function(s): create_effect, destroy_effect, ensure, pause_effect.
What calls component_root()?
component_root() is called by 1 function(s): _mount.

Analyze Your Own Codebase

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

Try Supermodel Free