snapshot() — svelte Function Reference
Architecture documentation for the snapshot() function in clone.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 532a740d_d410_0fd6_983a_933cb13808e7["snapshot()"] 258b696c_d923_7010_457a_b58908a057b0["clone.js"] 532a740d_d410_0fd6_983a_933cb13808e7 -->|defined in| 258b696c_d923_7010_457a_b58908a057b0 127e2f7b_34cf_0f73_a7c6_5c3a2aceac3c["log_if_contains_state()"] 127e2f7b_34cf_0f73_a7c6_5c3a2aceac3c -->|calls| 532a740d_d410_0fd6_983a_933cb13808e7 5f2148e6_2541_df61_7418_abc7753d7da6["log_dep()"] 5f2148e6_2541_df61_7418_abc7753d7da6 -->|calls| 532a740d_d410_0fd6_983a_933cb13808e7 521e299e_ab59_6272_422b_3ad55c315b6f["log_reactions()"] 521e299e_ab59_6272_422b_3ad55c315b6f -->|calls| 532a740d_d410_0fd6_983a_933cb13808e7 effdfef7_fe43_dc08_1914_518e8bf28c39["inspect()"] effdfef7_fe43_dc08_1914_518e8bf28c39 -->|calls| 532a740d_d410_0fd6_983a_933cb13808e7 70154e87_24eb_dcf5_8315_f0830d757263["log_entry()"] 70154e87_24eb_dcf5_8315_f0830d757263 -->|calls| 532a740d_d410_0fd6_983a_933cb13808e7 cb8572f5_46cc_29c0_76fa_a47b56411d5b["clone()"] 532a740d_d410_0fd6_983a_933cb13808e7 -->|calls| cb8572f5_46cc_29c0_76fa_a47b56411d5b 91ac632d_4b78_121b_62b2_baef268585b2["state_snapshot_uncloneable()"] 532a740d_d410_0fd6_983a_933cb13808e7 -->|calls| 91ac632d_4b78_121b_62b2_baef268585b2 style 532a740d_d410_0fd6_983a_933cb13808e7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/shared/clone.js lines 21–45
export function snapshot(value, skip_warning = false, no_tojson = false) {
if (DEV && !skip_warning) {
/** @type {string[]} */
const paths = [];
const copy = clone(value, new Map(), '', paths, null, no_tojson);
if (paths.length === 1 && paths[0] === '') {
// value could not be cloned
w.state_snapshot_uncloneable();
} else if (paths.length > 0) {
// some properties could not be cloned
const slice = paths.length > 10 ? paths.slice(0, 7) : paths.slice(0, 10);
const excess = paths.length - slice.length;
let uncloned = slice.map((path) => `- <value>${path}`).join('\n');
if (excess > 0) uncloned += `\n- ...and ${excess} more`;
w.state_snapshot_uncloneable(uncloned);
}
return copy;
}
return clone(value, new Map(), '', empty, null, no_tojson);
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does snapshot() do?
snapshot() is a function in the svelte codebase, defined in packages/svelte/src/internal/shared/clone.js.
Where is snapshot() defined?
snapshot() is defined in packages/svelte/src/internal/shared/clone.js at line 21.
What does snapshot() call?
snapshot() calls 2 function(s): clone, state_snapshot_uncloneable.
What calls snapshot()?
snapshot() is called by 5 function(s): inspect, log_dep, log_entry, log_if_contains_state, log_reactions.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free