tshtml
    Preparing search index...

    Function expr

    • Creates a JsExpression for embedding JavaScript values in HTML templates.

      Type Parameters

      • T = any

        The type of the value being wrapped

      Parameters

      • value: JsonLike<T>

        A JSON-compatible value to wrap

      Returns JsExpression<T>

      A JsExpression that can be rendered in templates

      import { expr } from 'tshtml';

      // Simple value
      const isActive = expr(true);

      // Object
      const config = expr({ threshold: 10, enabled: true });

      // Array
      const items = expr([1, 2, 3]);

      // String expression
      const js = expr('calculateValue()');