IStoryline interface
đ Descriptionâ
Interface that describes the immutable representation of the storyline.
đ Type declarationâ
interface IStoryline { moments: Moment[];Readonly pages: { number: number; active: boolean; activate: () => void; }[];Readonly presentMoment: Moment | undefined;Readonly presentSection: Section | undefined;Readonly presentNodes: IObservableNode[];Readonly all: (IObservableNode & { bookmark: IBookmark; })[];Readonly nodes: IObservableNode[];Readonly bookmarks: IBookmark[];Readonly slides: ISlide[];Readonly isEvaluating: boolean;Readonly isEmpty: boolean;Readonly isAtStart: boolean;Readonly isAtHead: boolean;Readonly isAtFinish: boolean;Readonly isFinishable: boolean;Readonly isFinishing: boolean;Readonly isFinished: boolean;Readonly isPausing: boolean;Readonly isPaused: boolean;Readonly hasDataCollected: boolean;Readonly isFailed: boolean;Readonly isPassed: boolean;Readonly mode: "paginated" | "continuous" | "progressive" | "ahead";Readonly direction: "forward" | "backward";Readonly count: number;Readonly enumerators: number;Readonly percentage: number;Readonly stepForward: () => boolean;Function stepBackward: () => boolean;Function stepToStart: () => boolean;Function stepToHead: () => boolean;Function stepToPage: (page: number) => boolean;Function finish: () => Promise<void> | false;Function map: <R>(fn: (moment: Moment, index: number) => R) => R[];Function }
đī¸ Propertiesâ
đˇī¸ all
â
Retrieves all observable nodes of the active moment (so the nodes of all moments in the moments
collection) with their corresponding bookmark.
Typeâ
(IObservableNode & { bookmark: IBookmark })[]
đˇī¸ bookmarks
â
Retrieves the bookmarks in the storyline.
Typeâ
đˇī¸ count
â
Retrieves the total number of observable nodes in the storyline.
Typeâ
number
đˇī¸ direction
â
Retrieves the most recent step direction of the storyline.
Typeâ
"forward" | "backward"
đˇī¸ enumerators
â
Retrieves the total number of observable nodes that have an enumerator value.
Typeâ
number
đˇī¸ hasDataCollected
â
Retrieves if the storyline has any data collected.
Typeâ
boolean
đˇī¸ isAtFinish
â
Retrieves if the present moment is at the finish of the storyline.
Typeâ
boolean
đˇī¸ isAtHead
â
Retrieves if the present moment is at the head of the storyline.
Typeâ
boolean
đˇī¸ isAtStart
â
Retrieves if the present moment is at the beginning of the storyline.
Typeâ
boolean
đˇī¸ isChanged
â
Retrieves if the storyline has changed since the last call of this prop.
Typeâ
boolean
đˇī¸ isEmpty
â
Retrieves if the storyline is empty (has no observable nodes, basically an empty form).
Typeâ
boolean
đˇī¸ isEvaluating
â
Retrieves if the storyline is evaluating.
Typeâ
boolean
đˇī¸ isFailed
â
Retrieves if the validation of the storyline failed.
Typeâ
boolean
đˇī¸ isFinishable
â
Retrieves if the storyline is finishable using the finish
method.
Typeâ
boolean
đˇī¸ isFinished
â
Retrieves if the storyline is finished.
Typeâ
boolean
đˇī¸ isFinishing
â
Retrieves if the storyline is finishing.
Typeâ
boolean
đˇī¸ isPassed
â
Retrieves if the validation of the storyline passed.
Typeâ
boolean
đˇī¸ isPaused
â
Retrieves if the storyline is paused.
Typeâ
boolean
đˇī¸ isPausing
â
Retrieves if the storyline is pausing.
Typeâ
boolean
đˇī¸ mode
â
Retrieves the mode of operation. 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.
Typeâ
"paginated" | "continuous" | "progressive" | "ahead"
đˇī¸ moments
â
Retrieves the moments that are in the storyline. There are three types of moments:
- Past moments;
- The present moment;
- Future moments.
The best way to understand these moment types is to visualize a paginated form runner, where the questions (node blocks) are presented on a page. Each section is a page. All pages that are already answered by the respondent are past moments. The current page the respondent is on is the present moment. And all the pages the respondent still needs to answer are future moments.
Typeâ
đˇī¸ nodes
â
Retrieves the observable nodes of the active moment (so the nodes of all moments in the moments
collection).
Typeâ
đˇī¸ pages
â
Retrieves the collection of pages.
Only available for runners in paginated mode.
Typeâ
{
/* Contains the page number. */
number: number;
/* Contains if the page is active. */
active: boolean;
/* Activates the page. */
activate: () => void;
}[]
đˇī¸ percentage
â
Retrieves the progress percentage of the storyline.
Can be used to show a progressbar that indicates the progress of the form.
Typeâ
number
đˇī¸ presentMoment
â
Retrieves the present moment.
Typeâ
Moment
| undefined
đˇī¸ presentNodes
â
Retrieves the observable nodes of the present moment.
Typeâ
đˇī¸ presentSection
â
Retrieves the section of the present moment.
Typeâ
Section
| undefined
đˇī¸ slides
â
Retrieves the slides in the storyline.
Typeâ
âļī¸ Functionsâ
đ§ finish
â
Finish the storyline when it is at the end.
You can only finish a form when it is finishable.
Signatureâ
finish(): Promise<void>
Return valueâ
Returns a Promise
that resolves when the instance was finished. The finish operation can be asynchronous. For example, when the form submits data to an endpoint. During the finish operation you could show a visual indicator to the respondent to indicate the form is submitting. When the promise resolves or rejects, the finish operation ends. When the promise rejects, the form remains active and the respondent should be able to try to finish the form again.
đ§ map
â
Maps moments of the storyline to a certain type.
Signatureâ
map<R>(fn: (moment: Moment, index: number) => R): R[]
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
fn | (moment: Moment , index: number) => R | No | Specifies the map function. |
Return valueâ
Returns the resulting array of the map operation.
đ§ stepBackward
â
Step backward in the storyline.
Signatureâ
stepBackward(): boolean
Return valueâ
Returns true
if the step succeeded.
đ§ stepForward
â
Step forward in the storyline.
Signatureâ
stepForward(): boolean
Return valueâ
Returns true
if the step succeeded.
đ§ stepToHead
â
Step to the head of the storyline.
Signatureâ
stepToHead(): boolean
Return valueâ
Returns true
if the step succeeded.
đ§ stepToPage
â
Steps to a page.
Only available for runners in paginated mode.
Signatureâ
stepToPage(page: number): boolean
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
page | number | No | Specifies the page to step to. |
Return valueâ
Returns true
if the step succeeded.
đ§ stepToStart
â
Step to the start of the storyline.
Signatureâ
stepToStart(): boolean
Return valueâ
Returns true
if the step succeeded.