Home / Function/ store_get() — svelte Function Reference

store_get() — svelte Function Reference

Architecture documentation for the store_get() function in index.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  39360823_5388_f1f6_b8cd_766eefdbd8ed["store_get()"]
  1c4bc493_24af_177e_7307_a999997aceac["index.js"]
  39360823_5388_f1f6_b8cd_766eefdbd8ed -->|defined in| 1c4bc493_24af_177e_7307_a999997aceac
  c57c1c2e_229a_0c30_d3f2_36362a13c998["store_mutate()"]
  c57c1c2e_229a_0c30_d3f2_36362a13c998 -->|calls| 39360823_5388_f1f6_b8cd_766eefdbd8ed
  bf775628_4abe_3faf_1335_d50376244959["update_store()"]
  bf775628_4abe_3faf_1335_d50376244959 -->|calls| 39360823_5388_f1f6_b8cd_766eefdbd8ed
  41a2d800_b473_b838_f0d0_396b538fad88["update_store_pre()"]
  41a2d800_b473_b838_f0d0_396b538fad88 -->|calls| 39360823_5388_f1f6_b8cd_766eefdbd8ed
  dbd11d8d_56bf_a872_dc19_f047771254fd["validate_store()"]
  39360823_5388_f1f6_b8cd_766eefdbd8ed -->|calls| dbd11d8d_56bf_a872_dc19_f047771254fd
  257e3ffe_958d_4447_c42b_d1cd05172fdb["subscribe_to_store()"]
  39360823_5388_f1f6_b8cd_766eefdbd8ed -->|calls| 257e3ffe_958d_4447_c42b_d1cd05172fdb
  style 39360823_5388_f1f6_b8cd_766eefdbd8ed fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/internal/server/index.js lines 231–250

export function store_get(store_values, store_name, store) {
	if (DEV) {
		validate_store(store, store_name.slice(1));
	}

	// it could be that someone eagerly updates the store in the instance script, so
	// we should only reuse the store value in the template
	if (store_name in store_values && store_values[store_name][0] === store) {
		return store_values[store_name][2];
	}

	store_values[store_name]?.[1](); // if store was switched, unsubscribe from old store
	store_values[store_name] = [store, null, undefined];
	const unsub = subscribe_to_store(
		store,
		/** @param {any} v */ (v) => (store_values[store_name][2] = v)
	);
	store_values[store_name][1] = unsub;
	return store_values[store_name][2];
}

Domain

Subdomains

Frequently Asked Questions

What does store_get() do?
store_get() is a function in the svelte codebase, defined in packages/svelte/src/internal/server/index.js.
Where is store_get() defined?
store_get() is defined in packages/svelte/src/internal/server/index.js at line 231.
What does store_get() call?
store_get() calls 2 function(s): subscribe_to_store, validate_store.
What calls store_get()?
store_get() is called by 3 function(s): store_mutate, update_store, update_store_pre.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free