OnDirective() — svelte Function Reference
Architecture documentation for the OnDirective() function in OnDirective.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 6b52ce28_cdc1_02a5_7b0d_c971a6877510["OnDirective()"] 50cc33f3_339a_55a6_7256_b481927bcf1a["OnDirective.js"] 6b52ce28_cdc1_02a5_7b0d_c971a6877510 -->|defined in| 50cc33f3_339a_55a6_7256_b481927bcf1a e4548a27_31cb_9533_21a3_1d9a4fcef460["event_directive_deprecated()"] 6b52ce28_cdc1_02a5_7b0d_c971a6877510 -->|calls| e4548a27_31cb_9533_21a3_1d9a4fcef460 313d2a82_30ea_3161_3aad_0cc2094979aa["mark_subtree_dynamic()"] 6b52ce28_cdc1_02a5_7b0d_c971a6877510 -->|calls| 313d2a82_30ea_3161_3aad_0cc2094979aa style 6b52ce28_cdc1_02a5_7b0d_c971a6877510 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/2-analyze/visitors/OnDirective.js lines 10–28
export function OnDirective(node, context) {
if (context.state.analysis.runes) {
const parent_type = context.path.at(-1)?.type;
// Don't warn on component events; these might not be under the author's control so the warning would be unactionable
if (parent_type === 'RegularElement' || parent_type === 'SvelteElement') {
w.event_directive_deprecated(node, node.name);
}
}
const parent = context.path.at(-1);
if (parent?.type === 'SvelteElement' || parent?.type === 'RegularElement') {
context.state.analysis.event_directive_node ??= node;
}
mark_subtree_dynamic(context.path);
context.next({ ...context.state, expression: node.metadata.expression });
}
Domain
Subdomains
Source
Frequently Asked Questions
What does OnDirective() do?
OnDirective() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/visitors/OnDirective.js.
Where is OnDirective() defined?
OnDirective() is defined in packages/svelte/src/compiler/phases/2-analyze/visitors/OnDirective.js at line 10.
What does OnDirective() call?
OnDirective() calls 2 function(s): event_directive_deprecated, mark_subtree_dynamic.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free