Skip to main content

Interface: Template

ghostly-runtime.Template

The Ghostly Template API.

Implemented by​

Methods​

ghostlyEnd​

β–Έ Optional ghostlyEnd(): void | Promise<void>

This optional method is invoked when all processing of the model is done. May be used to purge caches and other resources.

Returns​

void | Promise<void>

Defined in​

ghostly-runtime/src/types.ts:46


ghostlyFetch​

β–Έ Optional ghostlyFetch(attachmentInfo): void | GhostlyTypes | Promise<void | GhostlyTypes>

Asks the template to render an attachment. This call should not return or resolve until the attachment is stable and fully rendered.

Parameters​

NameTypeDescription
attachmentInfoAttachmentInfo<unknown>The attchment to render.

Returns​

void | GhostlyTypes | Promise<void | GhostlyTypes>

The attachment as raw binary data, a string, a JSON object, or nothing (in which case the Ghostly Engine will construct a response).

Defined in​

ghostly-runtime/src/types.ts:37


ghostlyInit​

β–Έ ghostlyInit(model): void | ModelInfo | Promise<void | ModelInfo>

Used to supply the model (data) that the template should render from.

Parameters​

NameTypeDescription
modelModelThe model to render.

Returns​

void | ModelInfo | Promise<void | ModelInfo>

Optional metainfo about the model and the attachments that can be produced.

Defined in​

ghostly-runtime/src/types.ts:17


ghostlyLoad​

β–Έ Optional ghostlyLoad(url): void | Promise<void>

This optional method will be invoked once the template has been loaded by the browser, or each time the fragment part (hash) changes in a cached template.

Parameters​

NameTypeDescription
urlstringThe template URL (including fragment).

Returns​

void | Promise<void>

Defined in​

ghostly-runtime/src/types.ts:9


ghostlyPreview​

β–Έ Optional ghostlyPreview(command?): PreviewResult | Promise<PreviewResult>

This method is used by the PreviewDriver to print and to find out the preferred size of the IFrame.

Parameters​

NameType
command?PreviewCommand

Returns​

PreviewResult | Promise<PreviewResult>

Defined in​

ghostly-runtime/src/types.ts:40


ghostlyRender​

β–Έ ghostlyRender(view): void | GhostlyTypes | Promise<void | GhostlyTypes>

Asks the template to render a specific view. This call should not return or resolve until the view is stable and fully rendered.

Parameters​

NameTypeDescription
viewView<unknown>The view to render.

Returns​

void | GhostlyTypes | Promise<void | GhostlyTypes>

The view as raw binary data, a string, a JSON object, or nothing (in which case the Ghostly Engine will construct a response).

Defined in​

ghostly-runtime/src/types.ts:27