IRunner interface
đ Descriptionâ
Interface that describes the return type of the useRunner hook.
đ Type declarationâ
interface IRunner { definition: IDefinition; view: "live" | "test" | "preview"; mode: "paginated" | "continuous" | "progressive" | "ahead" | undefined; l10n: L10n.Namespace;Readonly instance: Instance | undefined;Readonly fingerprint: string;Readonly stencil: string;Readonly actionables: string;Readonly storyline: Storyline | IRunnerSequenceItem[] | undefined;Readonly prologue: IPrologue | undefined;Readonly epilogue: IEpilogue | undefined;Readonly preview: "prologue" | "blocks" | "epilogue" | undefined;Readonly status: "empty" | "idle" | "running" | "preview" | "evaluating" | "stopped" | "finishing" | "finished" | "pausing" | "paused" | "error" | "error-outdated" | "error-rejected" | "error-paused";Readonly isRunning: boolean;Readonly isFinishing: boolean;Readonly isEvaluating: boolean;Readonly isPausing: boolean;Readonly allowStart: boolean;Readonly allowRestart: boolean;Readonly allowPause: boolean;Readonly allowStop: boolean;Readonly kickOff: () => void;Function start: () => Instance | undefined;Function restart: () => void;Function reload: (definition: IDefinition) => void;Function pause: ( data?: {}, pausing?: ( pSnapshot: ISnapshot, done: (result: "succeeded" | "failed" | "canceled") => void, item: IRunnerSequenceItem | undefined ) => void ) => Promise<ISnapshot> | ISnapshot | undefined;Function snapshot: (data?: {}) => ISnapshot | undefined;Function stop: () => void;Function update: () => void;Function discard: () => void;Function doAction: (type: "stage" | "unstage" | "focus" | "blur", node?: IObservableNode) => void;Function doPreview: (data: TRunnerPreviewData) => void;Function resetPreview: () => void;Function }
đī¸ Propertiesâ
đˇī¸ actionablesâ
Retrieves the form stencil hash for the actionable data.
Typeâ
string
More information about the stencil hashes in the Form data stencil guide. More information about exportable vs. actionable data can be found here.
đˇī¸ allowPauseâ
Retrieves if the runner can be paused.
Typeâ
boolean
đˇī¸ allowRestartâ
Retrieves if the runner can be restarted.
Typeâ
boolean
đˇī¸ allowStartâ
Retrieves if the runner can be started.
Typeâ
boolean
đˇī¸ allowStopâ
Retrieves if the runner can be stopped.
Typeâ
boolean
đˇī¸ definitionâ
Sets or retrieves the current form definition that is running.
Typeâ
đˇī¸ epilogueâ
Retrieves the optional epilogue for the form. This epilogue can be used by runners (that support it) to show a closing message when the form is completed.
Typeâ
đˇī¸ fingerprintâ
Retrieves the fingerprint of the form.
Typeâ
string
More information in the Form fingerprint guide.
đˇī¸ instanceâ
Retrieves the instance of the current running form.
Typeâ
Instance | undefined
đˇī¸ isEvaluatingâ
Retrieves if the runner is evaluating a block or condition.
Typeâ
boolean
đˇī¸ isFinishingâ
Retrieves if the runner is finishing (response data is being transmitted).
Typeâ
boolean
đˇī¸ isPausingâ
Retrieves if the runner is pausing (pause data is being transmitted).
Typeâ
boolean
đˇī¸ isRunningâ
Retrieves if the runner is running.
Typeâ
boolean
đˇī¸ l10nâ
Retrieves the localization namespace with helper functions for working with translations and locales.
Typeâ
đˇī¸ modeâ
Sets or retrieves the current mode of operation for the runner. It can be one of the following values:
paginated: Render each section on a separate page (this is the default behavior);continuous: Render all completed (past) sections and the current (present) section on a page;progressive: Render all completed (past), current (present) and future sections on a page till the point where one of the sections fails validation;ahead: Render all completed (past), current (present) and future sections on a page, regardless of the section's validation result.
When the runner is in sequence mode, this property returns undefined.
Typeâ
"paginated" | "continuous" | "progressive" | "ahead" | undefined
đˇī¸ previewâ
Retrieves the current preview mode of the runner. It can be one of the following values:
prologue: Prologue preview is active;blocks: Blocks preview is active;epilogue: Epilogue preview is active.
Typeâ
"prologue" | "blocks" | "epilogue" | undefined
đˇī¸ prologueâ
Retrieves the optional prologue for the form. This prologue can be used by runners (that support it) to show a welcome message before starting the actual form.
Typeâ
đˇī¸ statusâ
Retrieves the runner status. It can be one of the following values:
empty: The form is empty (has no blocks);idle: The runner is idle (ready to start);running: The runner is running;preview: The runner is in preview mode;evaluating: The runner is evaluating a block or condition;stopped: The runner is stopped;finishing: The runner is finishing (response data is being transmitted);finished: The runner has finished;pausing: The running is pausing (pause data is being transmitted);paused: The runner has paused;error: An unknown error occurred when finishing the form;error-outdated: The form definition is outdated;error-rejected: The server rejected the response data;error-paused: An error occurred when pausing the form.
Typeâ
"empty" | "idle" | "running" | "preview" | "evaluating" | "stopped" | "finishing" | "finished" | "pausing" | "paused" | "error" | "error-outdated" | "error-rejected" | "error-paused"
đˇī¸ stencilâ
Retrieves the form stencil hash for the exportable data.
Typeâ
string
More information about the stencil hashes in the Form data stencil guide. More information about exportable vs. actionable data can be found here.
đˇī¸ storylineâ
Retrieves the Storyline instance when the runner is not in sequence mode. Otherwise, it returns an array of sequence items.
This property may be undefined if there is no form running.
Typeâ
storyline | IRunnerSequenceItem[] | undefined
đˇī¸ viewâ
Sets or retrieves the current view mode of the runner. It can be one of the following values:
live: The form is running in normal (production) mode;test: The form is running in test mode (no response data is submitted);preview: The form is running in preview mode, which shows all blocks in a single view.
Typeâ
"live" | "test" | "preview"
âļī¸ Functionsâ
đ§ discardâ
Discards the error state of a runner when the runner status is either error, error-outdated, error-rejected, or error-rejected. It sets the runner status back to running.
The status property can be used to generate an error message in the UI when an error occurs. The discard function can then be used to remove/close this error message.
Signatureâ
() => void
đ§ doActionâ
Emits an action to the runner.
Signatureâ
doAction: (
type: "stage" | "unstage" | "focus" | "blur",
node?: IObservableNode
) => void;
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
type | "stage" | "unstage" | "focus" | "blur" | No | Specifies the type of action. |
node | IObservableNode | Yes | Reference to the node. |
đ§ doPreviewâ
Request a preview of the specified element of the form. This function is used in a live preview setup to bring a certain element in the form into view.
Signatureâ
(data: TRunnerPreviewData) => void
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
data | TRunnerPreviewData | No | Specifies the preview data. |
đ§ kickOffâ
Starts a runner in sequence mode.
Signatureâ
() => void
đ§ pauseâ
Pauses a form.
Signatureâ
(
data?: {},
pausing?: (
snapshot: ISnapshot,
done: (result: "succeeded" | "failed" | "canceled") => void,
item: IRunnerSequenceItem | undefined
) => void
) => Promise<ISnapshot> | ISnapshot | undefined;
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
data | {} | No | Optional data to store in the snapshot. |
pausing | (snapshot: ISnapshot, done: (result: "succeeded" | "failed" | "canceled") => void, item: IRunnerSequenceItem | undefined) => void | Yes | Optional function that can be used to process the pause data (for example, send it to an endpoint). When this function is supplied, the runner waits until the done function (with the result of the pause operation) is invoked. |
Return valueâ
Returns the ISnapshot object, a Promise for that object or undefined if the pause operation failed.
đ§ reloadâ
Reloads a form definition while trying to keep the data already collected.
Signatureâ
(definition: IDefinition) => void
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
definition | IDefinition | No | Specifies the form definition to load. |
đ§ resetPreviewâ
Resets the preview element.
Signatureâ
() => void
đ§ restartâ
Restarts a runner.
Signatureâ
() => void
đ§ snapshotâ
Creates a snapshot of the form (without pausing it).
Signatureâ
(data?: {}) => ISnapshot | undefined
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
data | {} | Yes | Optional data to store in the snapshot. |
Return valueâ
Returns the ISnapshot object.
đ§ startâ
Starts a runner.
Signatureâ
() => Instance | undefined
Return valueâ
Returns the Instance of the form or undefined if the form cannot start.
đ§ stopâ
Stops a runner.
Signatureâ
() => void
đ§ updateâ
Invokes a runner update.
Signatureâ
() => void