Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 13x 13x 13x 13x 13x 13x 13x 13x 13x 4x 11x 9x 9x 13x | /** @import { AST } from '#compiler' */
/** @import { ComponentContext } from '../types' */
import * as b from '../../../../utils/builders.js';
import { build_template_literal } from './shared/utils.js';
/**
* @param {AST.TitleElement} node
* @param {ComponentContext} context
*/
export function TitleElement(node, context) {
const { has_state, value } = build_template_literal(
/** @type {any} */ (node.fragment.nodes),
context.visit,
context.state
);
const statement = b.stmt(b.assignment('=', b.id('$.document.title'), value));
if (has_state) {
context.state.update.push(statement);
} else {
context.state.init.push(statement);
}
}
|