Home / Function/ constructor() — astro Function Reference

constructor() — astro Function Reference

Architecture documentation for the constructor() function in render-template.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  fab9733c_248e_c1ed_7ba2_77cedf7be6a3["constructor()"]
  a09367a5_8fe9_7718_47bb_f1d1ba04f076["RenderTemplateResult"]
  fab9733c_248e_c1ed_7ba2_77cedf7be6a3 -->|defined in| a09367a5_8fe9_7718_47bb_f1d1ba04f076
  style fab9733c_248e_c1ed_7ba2_77cedf7be6a3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/server/render/astro/render-template.ts lines 16–33

	constructor(htmlParts: TemplateStringsArray, expressions: unknown[]) {
		this.htmlParts = htmlParts;
		this.error = undefined;
		this.expressions = expressions.map((expression) => {
			// Wrap Promise expressions so we can catch errors
			// There can only be 1 error that we rethrow from an Astro component,
			// so this keeps track of whether or not we have already done so.
			if (isPromise(expression)) {
				return Promise.resolve(expression).catch((err) => {
					if (!this.error) {
						this.error = err;
						throw err;
					}
				});
			}
			return expression;
		});
	}

Domain

Subdomains

Frequently Asked Questions

What does constructor() do?
constructor() is a function in the astro codebase, defined in packages/astro/src/runtime/server/render/astro/render-template.ts.
Where is constructor() defined?
constructor() is defined in packages/astro/src/runtime/server/render/astro/render-template.ts at line 16.

Analyze Your Own Codebase

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

Try Supermodel Free