inited() — svelte Function Reference
Architecture documentation for the inited() function in date.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD cb2c7213_663e_b384_6fd0_98cacca887fb["inited()"] ead2ff3c_1f9f_37b6_47f8_3d9514f78e14["SvelteDate"] cb2c7213_663e_b384_6fd0_98cacca887fb -->|defined in| ead2ff3c_1f9f_37b6_47f8_3d9514f78e14 a08b6cc5_af73_1be4_d02f_3113cf8a8305["get()"] cb2c7213_663e_b384_6fd0_98cacca887fb -->|calls| a08b6cc5_af73_1be4_d02f_3113cf8a8305 311ef9f4_9b68_c178_c1db_3b8696f7d964["set_active_reaction()"] cb2c7213_663e_b384_6fd0_98cacca887fb -->|calls| 311ef9f4_9b68_c178_c1db_3b8696f7d964 63ee8247_ada4_9f1d_e139_0c1167cd5b1c["set()"] cb2c7213_663e_b384_6fd0_98cacca887fb -->|calls| 63ee8247_ada4_9f1d_e139_0c1167cd5b1c style cb2c7213_663e_b384_6fd0_98cacca887fb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/reactivity/date.js lines 62–117
#init() {
inited = true;
var proto = SvelteDate.prototype;
var date_proto = Date.prototype;
var methods = /** @type {Array<keyof Date & string>} */ (
Object.getOwnPropertyNames(date_proto)
);
for (const method of methods) {
if (method.startsWith('get') || method.startsWith('to') || method === 'valueOf') {
// @ts-ignore
proto[method] = function (...args) {
// don't memoize if there are arguments
// @ts-ignore
if (args.length > 0) {
get(this.#time);
// @ts-ignore
return date_proto[method].apply(this, args);
}
var d = this.#deriveds.get(method);
if (d === undefined) {
// lazily create the derived, but as though it were being
// created at the same time as the class instance
const reaction = active_reaction;
set_active_reaction(this.#reaction);
d = derived(() => {
get(this.#time);
// @ts-ignore
return date_proto[method].apply(this, args);
});
this.#deriveds.set(method, d);
set_active_reaction(reaction);
}
return get(d);
};
}
if (method.startsWith('set')) {
// @ts-ignore
proto[method] = function (...args) {
// @ts-ignore
var result = date_proto[method].apply(this, args);
set(this.#time, date_proto.getTime.call(this));
return result;
};
}
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does inited() do?
inited() is a function in the svelte codebase, defined in packages/svelte/src/reactivity/date.js.
Where is inited() defined?
inited() is defined in packages/svelte/src/reactivity/date.js at line 62.
What does inited() call?
inited() calls 3 function(s): get, set, set_active_reaction.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free