attach() — svelte Function Reference
Architecture documentation for the attach() function in attachments.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 4133c9ed_6ce6_0847_e62e_62aaf8690ab4["attach()"] da569db2_9d2a_e7c6_6b96_4551a150836c["attachments.js"] 4133c9ed_6ce6_0847_e62e_62aaf8690ab4 -->|defined in| da569db2_9d2a_e7c6_6b96_4551a150836c 9a87a496_4e7d_9214_8bba_7bb2e3e47939["attribute_effect()"] 9a87a496_4e7d_9214_8bba_7bb2e3e47939 -->|calls| 4133c9ed_6ce6_0847_e62e_62aaf8690ab4 045d66dd_55a4_3b79_abab_2dd2ce6329b1["selectedcontent()"] 045d66dd_55a4_3b79_abab_2dd2ce6329b1 -->|calls| 4133c9ed_6ce6_0847_e62e_62aaf8690ab4 a3686fa4_d487_d514_9dcd_bcbf5853b659["managed()"] 4133c9ed_6ce6_0847_e62e_62aaf8690ab4 -->|calls| a3686fa4_d487_d514_9dcd_bcbf5853b659 410f774f_2d1a_7114_fcba_b292ed7cae3a["destroy_effect()"] 4133c9ed_6ce6_0847_e62e_62aaf8690ab4 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 4ca1b5f2_087e_afec_72d9_534a30fbfe1f["branch()"] 4133c9ed_6ce6_0847_e62e_62aaf8690ab4 -->|calls| 4ca1b5f2_087e_afec_72d9_534a30fbfe1f a985ae40_8ef8_7ef2_adad_116fbf97e70c["effect()"] 4133c9ed_6ce6_0847_e62e_62aaf8690ab4 -->|calls| a985ae40_8ef8_7ef2_adad_116fbf97e70c style 4133c9ed_6ce6_0847_e62e_62aaf8690ab4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/dom/elements/attachments.js lines 12–33
export function attach(node, get_fn) {
/** @type {false | undefined | ((node: Element) => void)} */
var fn = undefined;
/** @type {Effect | null} */
var e;
managed(() => {
if (fn !== (fn = get_fn())) {
if (e) {
destroy_effect(e);
e = null;
}
if (fn) {
e = branch(() => {
effect(() => /** @type {(node: Element) => void} */ (fn)(node));
});
}
}
});
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does attach() do?
attach() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/elements/attachments.js.
Where is attach() defined?
attach() is defined in packages/svelte/src/internal/client/dom/elements/attachments.js at line 12.
What does attach() call?
attach() calls 4 function(s): branch, destroy_effect, effect, managed.
What calls attach()?
attach() is called by 2 function(s): attribute_effect, selectedcontent.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free