Skip to main content

QTemplate

@quik/templates


@quik/templates / QTemplate

Abstract Class: QTemplate<TParameters>

Defined in: templates/src/QTemplate.ts:11

Base class for all Handlebars templates.

Extends​

  • QObject

Type Parameters​

TParameters​

TParameters extends ObjectLiteral = ObjectLiteral

Shape of the parameters object accepted by the template.

Constructors​

Constructor​

protected new QTemplate<TParameters>(templateName, parameters?): QTemplate<TParameters>

Defined in: templates/src/QTemplate.ts:18

Creates a new template instance.

Parameters​

templateName​

string

Name of the template registered in TemplatesStore.

parameters?​

TParameters

Optional parameters passed to the template.

Returns​

QTemplate<TParameters>

Overrides​

QObject.constructor

Accessors​

logger​

Get Signature​

get protected logger(): IQLogger

Defined in: core/src/QObject.ts:15

The logger getter for the object.

Returns​

IQLogger

Inherited from​

QObject.logger


name​

Get Signature​

get name(): string

Defined in: core/src/QObject.ts:8

Returns​

string

Inherited from​

QObject.name


parameters​

Get Signature​

get parameters(): TParameters

Defined in: templates/src/QTemplate.ts:40

Parameters that will be forwarded to the template.

Returns​

TParameters

Set Signature​

set parameters(parameters): void

Defined in: templates/src/QTemplate.ts:47

Sets the parameters for the template.

Parameters​
parameters​

TParameters

Returns​

void


templateName​

Get Signature​

get templateName(): string

Defined in: templates/src/QTemplate.ts:28

Name of the template that will be rendered.

Returns​

string

Set Signature​

set templateName(filename): void

Defined in: templates/src/QTemplate.ts:32

Parameters​
filename​

string

Returns​

void

Methods​

endSpan()​

protected endSpan(span): void

Defined in: core/src/QObject.ts:35

End a span returned by startSpan.

Parameters​

span​

TelemetrySpan

The span to end.

Returns​

void

Inherited from​

QObject.endSpan


recordSpanError()​

protected recordSpanError(span, err): void

Defined in: core/src/QObject.ts:45

Record an exception on an active span.

Parameters​

span​

TelemetrySpan

The span to record the error on.

err​

unknown

The error to record.

Returns​

void

Inherited from​

QObject.recordSpanError


render()​

render(): string

Defined in: templates/src/QTemplate.ts:55

Renders the template using the provided parameters.

Returns​

string


setSpanAttribute()​

protected setSpanAttribute(span, key, value): void

Defined in: core/src/QObject.ts:64

Set a single attribute on an active span.

Parameters​

span​

TelemetrySpan

The span to update.

key​

string

Attribute key.

value​

string | number | boolean

Attribute value.

Returns​

void

Inherited from​

QObject.setSpanAttribute


startSpan()​

protected startSpan(spanName, options?): TelemetrySpan

Defined in: core/src/QObject.ts:26

Start a telemetry span for the given operation name. Returns undefined when no telemetry provider is active.

Parameters​

spanName​

string

Name of the span.

options?​

TelemetrySpanOptions

Optional span attributes and kind.

Returns​

TelemetrySpan

Inherited from​

QObject.startSpan