fromAction() — svelte Function Reference
Architecture documentation for the fromAction() function in index.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 351b621b_c70c_9d47_784b_d417b59077b5["fromAction()"] 046e8489_7de3_c124_9983_4b051435f74f["index.js"] 351b621b_c70c_9d47_784b_d417b59077b5 -->|defined in| 046e8489_7de3_c124_9983_4b051435f74f 7494b934_a3b8_689e_91b6_8435e26461c5["render_effect()"] 351b621b_c70c_9d47_784b_d417b59077b5 -->|calls| 7494b934_a3b8_689e_91b6_8435e26461c5 20340432_01a2_6741_abf4_60ccab51cdb3["teardown()"] 351b621b_c70c_9d47_784b_d417b59077b5 -->|calls| 20340432_01a2_6741_abf4_60ccab51cdb3 style 351b621b_c70c_9d47_784b_d417b59077b5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/attachments/index.js lines 96–113
export function fromAction(action, fn = /** @type {() => T} */ (noop)) {
return (element) => {
const { update, destroy } = untrack(() => action(element, fn()) ?? {});
if (update) {
var ran = false;
render_effect(() => {
const arg = fn();
if (ran) update(arg);
});
ran = true;
}
if (destroy) {
teardown(destroy);
}
};
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does fromAction() do?
fromAction() is a function in the svelte codebase, defined in packages/svelte/src/attachments/index.js.
Where is fromAction() defined?
fromAction() is defined in packages/svelte/src/attachments/index.js at line 96.
What does fromAction() call?
fromAction() calls 2 function(s): render_effect, teardown.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free