subscribe_to_store() — svelte Function Reference
Architecture documentation for the subscribe_to_store() function in utils.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 257e3ffe_958d_4447_c42b_d1cd05172fdb["subscribe_to_store()"] dacfcaf1_66cb_9fe3_083b_4fee2b4eb64f["utils.js"] 257e3ffe_958d_4447_c42b_d1cd05172fdb -->|defined in| dacfcaf1_66cb_9fe3_083b_4fee2b4eb64f bd40e037_69e2_71b9_9d3d_0182230611c9["store_get()"] bd40e037_69e2_71b9_9d3d_0182230611c9 -->|calls| 257e3ffe_958d_4447_c42b_d1cd05172fdb 39360823_5388_f1f6_b8cd_766eefdbd8ed["store_get()"] 39360823_5388_f1f6_b8cd_766eefdbd8ed -->|calls| 257e3ffe_958d_4447_c42b_d1cd05172fdb 859279c4_7e63_3830_c144_7e5e2ad3366d["derived()"] 859279c4_7e63_3830_c144_7e5e2ad3366d -->|calls| 257e3ffe_958d_4447_c42b_d1cd05172fdb 4cf4c423_76ea_40eb_1692_69aae30c30f1["get()"] 4cf4c423_76ea_40eb_1692_69aae30c30f1 -->|calls| 257e3ffe_958d_4447_c42b_d1cd05172fdb 3b9fcc16_eee3_208a_bc65_45c294d8565a["run()"] 257e3ffe_958d_4447_c42b_d1cd05172fdb -->|calls| 3b9fcc16_eee3_208a_bc65_45c294d8565a style 257e3ffe_958d_4447_c42b_d1cd05172fdb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/store/utils.js lines 12–36
export function subscribe_to_store(store, run, invalidate) {
if (store == null) {
// @ts-expect-error
run(undefined);
// @ts-expect-error
if (invalidate) invalidate(undefined);
return noop;
}
// Svelte store takes a private second argument
// StartStopNotifier could mutate state, and we want to silence the corresponding validation error
const unsub = untrack(() =>
store.subscribe(
run,
// @ts-expect-error
invalidate
)
);
// Also support RxJS
// @ts-expect-error TODO fix this in the types?
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does subscribe_to_store() do?
subscribe_to_store() is a function in the svelte codebase, defined in packages/svelte/src/store/utils.js.
Where is subscribe_to_store() defined?
subscribe_to_store() is defined in packages/svelte/src/store/utils.js at line 12.
What does subscribe_to_store() call?
subscribe_to_store() calls 1 function(s): run.
What calls subscribe_to_store()?
subscribe_to_store() is called by 4 function(s): derived, get, store_get, store_get.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free