Home / Function/ constructor() — svelte Function Reference

constructor() — svelte Function Reference

Architecture documentation for the constructor() function in media-query.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  10b48c36_e2cf_aac5_20bf_b2b44da2ea4e["constructor()"]
  1aea5f41_f788_1e74_9230_94ed8ed9ba5c["MediaQuery"]
  10b48c36_e2cf_aac5_20bf_b2b44da2ea4e -->|defined in| 1aea5f41_f788_1e74_9230_94ed8ed9ba5c
  142e2be6_1ec4_1b85_9b82_cefdeae4a983["constructor()"]
  10b48c36_e2cf_aac5_20bf_b2b44da2ea4e -->|calls| 142e2be6_1ec4_1b85_9b82_cefdeae4a983
  style 10b48c36_e2cf_aac5_20bf_b2b44da2ea4e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/reactivity/media-query.js lines 42–54

	constructor(query, fallback) {
		let final_query =
			parenthesis_regex.test(query) ||
			// we need to use `some` here because technically this `window.matchMedia('random,screen')` still returns true
			query.split(/[\s,]+/).some((keyword) => non_parenthesized_keywords.has(keyword.trim()))
				? query
				: `(${query})`;
		const q = window.matchMedia(final_query);
		super(
			() => q.matches,
			(update) => on(q, 'change', update)
		);
	}

Subdomains

Frequently Asked Questions

What does constructor() do?
constructor() is a function in the svelte codebase, defined in packages/svelte/src/reactivity/media-query.js.
Where is constructor() defined?
constructor() is defined in packages/svelte/src/reactivity/media-query.js at line 42.
What does constructor() call?
constructor() calls 1 function(s): constructor.

Analyze Your Own Codebase

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

Try Supermodel Free