apply() — svelte Function Reference
Architecture documentation for the apply() function in events.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c["apply()"] 2c990bd1_acff_5910_3af2_ab75f655b31b["events.js"] 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c -->|defined in| 2c990bd1_acff_5910_3af2_ab75f655b31b 1ca72ded_14bc_41b5_4ea5_b8dc496dc853["trusted()"] 1ca72ded_14bc_41b5_4ea5_b8dc496dc853 -->|calls| 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c 53354e8d_42d0_70c2_255c_9f5b50649cd7["self()"] 53354e8d_42d0_70c2_255c_9f5b50649cd7 -->|calls| 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c 72948d3d_a35f_64f1_880e_496d39c98799["stopPropagation()"] 72948d3d_a35f_64f1_880e_496d39c98799 -->|calls| 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c 6b9cfdba_ca05_bb2e_0fdb_a6b0b9578ed8["once()"] 6b9cfdba_ca05_bb2e_0fdb_a6b0b9578ed8 -->|calls| 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c 8e27f1e1_9bca_ae6a_933e_b60efce97e52["stopImmediatePropagation()"] 8e27f1e1_9bca_ae6a_933e_b60efce97e52 -->|calls| 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c 1a241ae5_105a_d719_d800_eda3444dbf2a["preventDefault()"] 1a241ae5_105a_d719_d800_eda3444dbf2a -->|calls| 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c 67e61f88_f0df_94e8_9ca2_7858698b5b1e["event_handler_invalid()"] 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c -->|calls| 67e61f88_f0df_94e8_9ca2_7858698b5b1e style 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/dom/elements/events.js lines 305–338
export function apply(
thunk,
element,
args,
component,
loc,
has_side_effects = false,
remove_parens = false
) {
let handler;
let error;
try {
handler = thunk();
} catch (e) {
error = e;
}
if (typeof handler !== 'function' && (has_side_effects || handler != null || error)) {
const filename = component?.[FILENAME];
const location = loc ? ` at ${filename}:${loc[0]}:${loc[1]}` : ` in ${filename}`;
const phase = args[0]?.eventPhase < Event.BUBBLING_PHASE ? 'capture' : '';
const event_name = args[0]?.type + phase;
const description = `\`${event_name}\` handler${location}`;
const suggestion = remove_parens ? 'remove the trailing `()`' : 'add a leading `() =>`';
w.event_handler_invalid(description, suggestion);
if (error) {
throw error;
}
}
handler?.apply(element, args);
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does apply() do?
apply() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/elements/events.js.
Where is apply() defined?
apply() is defined in packages/svelte/src/internal/client/dom/elements/events.js at line 305.
What does apply() call?
apply() calls 1 function(s): event_handler_invalid.
What calls apply()?
apply() is called by 6 function(s): once, preventDefault, self, stopImmediatePropagation, stopPropagation, trusted.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free