Skip to main content

Class: TemplateDriver

ghostly-runtime.TemplateDriver

Helper class to invoke the defined protocol methods using a user-defined sendMessage implementation.

Hierarchy​

Implements​

Constructors​

constructor​

β€’ new TemplateDriver()

Properties​

_template​

β€’ Protected Optional _template: string

Defined in​

ghostly-runtime/src/driver.ts:5

Methods​

ghostlyEnd​

β–Έ ghostlyEnd(): 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​

Promise<void>

Implementation of​

Template.ghostlyEnd

Defined in​

ghostly-runtime/src/driver.ts:54


ghostlyFetch​

β–Έ ghostlyFetch(info): Promise<GhostlyTypes>

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

Parameters​

NameType
infoAttachmentInfo<unknown>

Returns​

Promise<GhostlyTypes>

Implementation of​

Template.ghostlyFetch

Defined in​

ghostly-runtime/src/driver.ts:39


ghostlyInit​

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

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

Parameters​

NameType
modelModel

Returns​

Promise<undefined | ModelInfo>

Implementation of​

Template.ghostlyInit

Defined in​

ghostly-runtime/src/driver.ts:12


ghostlyLoad​

β–Έ ghostlyLoad(template): 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​

NameType
templatestring

Returns​

Promise<void>

Implementation of​

Template.ghostlyLoad

Defined in​

ghostly-runtime/src/driver.ts:7


ghostlyPreview​

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

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

Parameters​

NameType
commandPreviewCommand

Returns​

Promise<PreviewResult>

Implementation of​

Template.ghostlyPreview

Defined in​

ghostly-runtime/src/driver.ts:43


ghostlyRender​

β–Έ ghostlyRender(view): Promise<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​

NameType
viewView<unknown>

Returns​

Promise<GhostlyTypes>

Implementation of​

Template.ghostlyRender

Defined in​

ghostly-runtime/src/driver.ts:35


sendMessage​

β–Έ Protected Abstract sendMessage(request): Promise<GhostlyTypes>

Abstract method that must be provided by subclasses. Should send the request to the template, wait for response and then unpack and return the result.

Parameters​

NameTypeDescription
requestGhostlyRequestThe raw request to send.

Returns​

Promise<GhostlyTypes>

The unpacked response.

Defined in​

ghostly-runtime/src/driver.ts:65