Interface: HistoryManagerInterface
Defined in: src/history/interfaces/HistoryManagerInterface.ts:13
Properties
back
> back: (props, options?) => Promise<StepLabelResultType>
Defined in: src/history/interfaces/HistoryManagerInterface.ts:73
Go back to the last step and add it to the history.
Parameters
props
StepLabelProps
The step label properties.
options?
The navigation options.
steps?
number
The number of steps to go back. Must be greater than 0.
Default
1Returns
Promise<StepLabelResultType>
canGoBack
> readonly canGoBack: boolean
Defined in: src/history/interfaces/HistoryManagerInterface.ts:89
Return true if it is possible to go back.
currentLabelHistory
> readonly currentLabelHistory: NarrationHistory[]
Defined in: src/history/interfaces/HistoryManagerInterface.ts:40
Get the history of the latest steps belonging to the current label and its child labels.
This is effectively the current "page" of an interactive book: it starts over every time a NarrationManagerInterface.jump is performed.
Returns
the history of the dialogues, choices and steps
currentPageParagraphs
> readonly currentPageParagraphs: NarrationHistory[][]
Defined in: src/history/interfaces/HistoryManagerInterface.ts:50
Get the current page (HistoryManagerInterface.currentLabelHistory) split into paragraphs.
A new paragraph starts every time the number of opened labels changes compared to the previous step (i.e. a NarrationManagerInterface.call was made, or a called label returned), using NarrationHistory.openedLabelsNumber.
Returns
the current page as an ordered list of paragraphs, each one a list of steps
diffMap
> readonly diffMap: CachedMap<number, Difference[]>
Defined in: src/history/interfaces/HistoryManagerInterface.ts:149
Map that contains all the differences between the steps in the history. The differences will be used to restore a step.
Don't edit unless you're sure what you're doing.
goBackMode
> goBackMode: HistoryGoBackModeType
Defined in: src/history/interfaces/HistoryManagerInterface.ts:26
How often a go-back-able checkpoint is recorded.
Default
"step"
"step": every single narration step, matching visual-novel-style games where the player may want to undo one line/sprite change at a time."paragraph": only when a new paragraph starts (HistoryManagerInterface.currentPageParagraphs), a choice is proposed, or an input is requested - matching book-style narrations where undoing mid-paragraph doesn't make sense to the player. Every step within a paragraph is merged into the checkpoint that closes it out:back()from anywhere inside paragraph N jumps all the way to the start of paragraph N-1, not to wherever you were right before N began - the whole of paragraph N-1 gets replayed.
lastKey
> readonly lastKey: number | null
Defined in: src/history/interfaces/HistoryManagerInterface.ts:118
Get the last key (id) of the history.
narrationMap
> readonly narrationMap: CachedMap<number, NarrationHistory>
Defined in: src/history/interfaces/HistoryManagerInterface.ts:155
Map that contains all the narration history.
Don't edit unless you're sure what you're doing.
narrativeHistory
> readonly narrativeHistory: NarrationHistory[]
Defined in: src/history/interfaces/HistoryManagerInterface.ts:31
Get the narrative history.
Returns
the history of the dialogues, choices and steps
size
> readonly size: number
Defined in: src/history/interfaces/HistoryManagerInterface.ts:114
Number of items in the history.
stepLimitSaved
> stepLimitSaved: number
Defined in: src/history/interfaces/HistoryManagerInterface.ts:61
The number of steps to keep in the history into the save file.
The other older steps will be compressed will be used in HistoryManagerInterface.narrativeHistory to show the older dialogues. In the compressed steps, the canvas and storage information will be removed.
This also means that a player, after saving and loading a save, will only be able to go back to NarrationManagerInterface.stepLimitSaved steps.
If you want to keep all steps in the history, you can set this value to Infinity.
stepsInfoMap
> readonly stepsInfoMap: CachedMap<number, Omit<HistoryStep, "diff">>
Defined in: src/history/interfaces/HistoryManagerInterface.ts:142
Map that contains all information about the steps in the history.
Don't edit unless you're sure what you're doing.
Methods
add()
> add(historyInfo?, opstions?): void
Defined in: src/history/interfaces/HistoryManagerInterface.ts:98
Add a step to the history.
Parameters
historyInfo?
HistoryInfo
Info about the step to add.
opstions?
Options to add the step.
ignoreSameStep?
boolean
If true, the step will not be added to the history if the current step is the same as the last step.
Returns
void
blockGoBack()
> blockGoBack(): void
Defined in: src/history/interfaces/HistoryManagerInterface.ts:85
Block the go back function.
Returns
void
clear()
> clear(): void
Defined in: src/history/interfaces/HistoryManagerInterface.ts:110
Clear the history.
Returns
void
delete()
> delete(stepIndex): void
Defined in: src/history/interfaces/HistoryManagerInterface.ts:136
Remove a step from the history.
Parameters
stepIndex
number
The key (id) of the step to remove.
Returns
void
True if the step was removed, false if it was not found.
export()
> export(): HistoryGameState
Defined in: src/history/interfaces/HistoryManagerInterface.ts:163
Export the history to an object.
Returns
The history in an object.
get()
> get(stepIndex): NarrationHistory | undefined
Defined in: src/history/interfaces/HistoryManagerInterface.ts:130
Get a step from the history.
Note: If the step not contains any information, this method will return undefined.
Parameters
stepIndex
number
The key (id) of the step to get.
Returns
NarrationHistory | undefined
The step.
keys()
> keys(): MapIterator<number>
Defined in: src/history/interfaces/HistoryManagerInterface.ts:122
Get all the keys (id) of the history.
Returns
MapIterator<number>
removeNarrativeHistory()
> removeNarrativeHistory(itemsNumber?): void
Defined in: src/history/interfaces/HistoryManagerInterface.ts:66
Delete the narrative history.
Parameters
itemsNumber?
number
The number of items to delete. If undefined, all items will be deleted.
Returns
void
restore()
> restore(data): Promise<void>
Defined in: src/history/interfaces/HistoryManagerInterface.ts:168
Restore the history from an object.
Parameters
data
object
The history in an object.
Returns
Promise<void>