Class: TemplateDriver
ghostly-runtime.TemplateDriver
Helper class to invoke the defined protocol methods using a user-defined sendMessage implementation.
Hierarchyβ
TemplateDriverβ³
PreviewDriver
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β
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β
| Name | Type |
|---|---|
info | AttachmentInfo<unknown> |
Returnsβ
Promise<GhostlyTypes>
Implementation ofβ
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β
| Name | Type |
|---|---|
model | Model |
Returnsβ
Promise<undefined | ModelInfo>
Implementation ofβ
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β
| Name | Type |
|---|---|
template | string |
Returnsβ
Promise<void>
Implementation ofβ
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β
| Name | Type |
|---|---|
command | PreviewCommand |
Returnsβ
Promise<PreviewResult>
Implementation ofβ
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β
| Name | Type |
|---|---|
view | View<unknown> |
Returnsβ
Promise<GhostlyTypes>
Implementation ofβ
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β
| Name | Type | Description |
|---|---|---|
request | GhostlyRequest | The raw request to send. |
Returnsβ
Promise<GhostlyTypes>
The unpacked response.