Home / Function/ validate_binding() — svelte Function Reference

validate_binding() — svelte Function Reference

Architecture documentation for the validate_binding() function in validate.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  addf2179_214f_fba8_e3ed_31d58ea8ab01["validate_binding()"]
  a927f58e_e80a_6a7b_4e18_83d6571bb37f["validate.js"]
  addf2179_214f_fba8_e3ed_31d58ea8ab01 -->|defined in| a927f58e_e80a_6a7b_4e18_83d6571bb37f
  a1d7f44d_5b8b_629c_39ba_eeb1486eee4a["run_after_blockers()"]
  addf2179_214f_fba8_e3ed_31d58ea8ab01 -->|calls| a1d7f44d_5b8b_629c_39ba_eeb1486eee4a
  7494b934_a3b8_689e_91b6_8435e26461c5["render_effect()"]
  addf2179_214f_fba8_e3ed_31d58ea8ab01 -->|calls| 7494b934_a3b8_689e_91b6_8435e26461c5
  30a9ce87_f086_adc7_ccd8_8a6ffbd469fe["capture_store_binding()"]
  addf2179_214f_fba8_e3ed_31d58ea8ab01 -->|calls| 30a9ce87_f086_adc7_ccd8_8a6ffbd469fe
  632f76fe_c751_f840_6f53_19f8bfbf5524["binding_property_non_reactive()"]
  addf2179_214f_fba8_e3ed_31d58ea8ab01 -->|calls| 632f76fe_c751_f840_6f53_19f8bfbf5524
  style addf2179_214f_fba8_e3ed_31d58ea8ab01 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/internal/client/validate.js lines 17–54

export function validate_binding(binding, blockers, get_object, get_property, line, column) {
	run_after_blockers(blockers, () => {
		var warned = false;

		var filename = dev_current_component_function?.[FILENAME];

		render_effect(() => {
			if (warned) return;

			var [object, is_store_sub] = capture_store_binding(get_object);

			if (is_store_sub) return;

			var property = get_property();

			var ran = false;

			// by making the (possibly false, but it would be an extreme edge case) assumption
			// that a getter has a corresponding setter, we can determine if a property is
			// reactive by seeing if this effect has dependencies
			var effect = render_effect(() => {
				if (ran) return;

				// eslint-disable-next-line @typescript-eslint/no-unused-expressions
				object[property];
			});

			ran = true;

			if (effect.deps === null) {
				var location = `${filename}:${line}:${column}`;
				w.binding_property_non_reactive(binding, location);

				warned = true;
			}
		});
	});
}

Domain

Subdomains

Frequently Asked Questions

What does validate_binding() do?
validate_binding() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/validate.js.
Where is validate_binding() defined?
validate_binding() is defined in packages/svelte/src/internal/client/validate.js at line 17.
What does validate_binding() call?
validate_binding() calls 4 function(s): binding_property_non_reactive, capture_store_binding, render_effect, run_after_blockers.

Analyze Your Own Codebase

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

Try Supermodel Free