Home / Function/ Main() — svelte Function Reference

Main() — svelte Function Reference

Architecture documentation for the Main() function in main.svelte.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  3c36efc9_2481_5743_c9a1_8475727823a7["Main()"]
  e03ff23c_6b15_1812_a35a_a0205c536450["main.svelte.js"]
  3c36efc9_2481_5743_c9a1_8475727823a7 -->|defined in| e03ff23c_6b15_1812_a35a_a0205c536450
  style 3c36efc9_2481_5743_c9a1_8475727823a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/tests/snapshot/samples/dynamic-attributes-casing/_expected/client/main.svelte.js lines 6–39

export default function Main($$anchor) {
	// needs to be a snapshot test because jsdom does auto-correct the attribute casing
	let x = 'test';

	let y = () => 'test';
	var fragment = root();
	var div = $.first_child(fragment);

	$.set_attribute(div, 'foobar', x);

	var svg = $.sibling(div, 2);

	$.set_attribute(svg, 'viewBox', x);

	var custom_element = $.sibling(svg, 2);

	$.set_custom_element_data(custom_element, 'fooBar', x);

	var div_1 = $.sibling(custom_element, 2);
	var svg_1 = $.sibling(div_1, 2);
	var custom_element_1 = $.sibling(svg_1, 2);

	$.template_effect(() => $.set_custom_element_data(custom_element_1, 'fooBar', y()));

	$.template_effect(
		($0, $1) => {
			$.set_attribute(div_1, 'foobar', $0);
			$.set_attribute(svg_1, 'viewBox', $1);
		},
		[y, y]
	);

	$.append($$anchor, fragment);
}

Domain

Subdomains

Frequently Asked Questions

What does Main() do?
Main() is a function in the svelte codebase, defined in packages/svelte/tests/snapshot/samples/dynamic-attributes-casing/_expected/client/main.svelte.js.
Where is Main() defined?
Main() is defined in packages/svelte/tests/snapshot/samples/dynamic-attributes-casing/_expected/client/main.svelte.js at line 6.

Analyze Your Own Codebase

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

Try Supermodel Free