# Interface: HistoryManagerInterface (/pixi-vn/index/interfaces/HistoryManagerInterface)



Defined in: [src/history/interfaces/HistoryManagerInterface.ts:13](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L13)

## Properties [#properties]

### back [#back]

\> **back**: (`props`, `options?`) => `Promise`\<[`StepLabelResultType`](/pixi-vn/index/type-aliases/StepLabelResultType)>

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:73](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L73)

Go back to the last step and add it to the history.

#### Parameters [#parameters]

##### props [#props]

`StepLabelProps`

The step label properties.

##### options? [#options]

The navigation options.

###### steps? [#steps]

`number`

The number of steps to go back. Must be greater than 0.

**Default**

```ts
1
```

#### Returns [#returns]

`Promise`\<[`StepLabelResultType`](/pixi-vn/index/type-aliases/StepLabelResultType)>

***

### canGoBack [#cangoback]

\> `readonly` **canGoBack**: `boolean`

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:89](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L89)

Return true if it is possible to go back.

***

### currentLabelHistory [#currentlabelhistory]

\> `readonly` **currentLabelHistory**: [`NarrationHistory`](/pixi-vn/index/interfaces/NarrationHistory)\[]

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:40](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L40)

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](/pixi-vn/index/interfaces/NarrationManagerInterface#jump) is performed.

#### Returns [#returns-1]

the history of the dialogues, choices and steps

***

### currentPageParagraphs [#currentpageparagraphs]

\> `readonly` **currentPageParagraphs**: [`NarrationHistory`](/pixi-vn/index/interfaces/NarrationHistory)\[]\[]

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:50](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L50)

Get the current page ([HistoryManagerInterface.currentLabelHistory](#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](/pixi-vn/index/interfaces/NarrationManagerInterface#call) was made, or a called label returned), using
[NarrationHistory.openedLabelsNumber](/pixi-vn/index/interfaces/NarrationHistory#openedlabelsnumber).

#### Returns [#returns-2]

the current page as an ordered list of paragraphs, each one a list of steps

***

### diffMap [#diffmap]

\> `readonly` **diffMap**: [`CachedMap`](/pixi-vn/index/classes/CachedMap)\<`number`, `Difference`\[]>

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:149](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L149)

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]

\> **goBackMode**: [`HistoryGoBackModeType`](/pixi-vn/index/type-aliases/HistoryGoBackModeType)

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:26](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L26)

How often a go-back-able checkpoint is recorded.

#### Default [#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](#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 [#lastkey]

\> `readonly` **lastKey**: `number` | `null`

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:118](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L118)

Get the last key (id) of the history.

***

### narrationMap [#narrationmap]

\> `readonly` **narrationMap**: [`CachedMap`](/pixi-vn/index/classes/CachedMap)\<`number`, [`NarrationHistory`](/pixi-vn/index/interfaces/NarrationHistory)>

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:155](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L155)

Map that contains all the narration history.

**Don't edit unless you're sure what you're doing.**

***

### narrativeHistory [#narrativehistory]

\> `readonly` **narrativeHistory**: [`NarrationHistory`](/pixi-vn/index/interfaces/NarrationHistory)\[]

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:31](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L31)

Get the narrative history.

#### Returns [#returns-3]

the history of the dialogues, choices and steps

***

### size [#size]

\> `readonly` **size**: `number`

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:114](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L114)

Number of items in the history.

***

### stepLimitSaved [#steplimitsaved]

\> **stepLimitSaved**: `number`

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:61](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L61)

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](#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 [#stepsinfomap]

\> `readonly` **stepsInfoMap**: [`CachedMap`](/pixi-vn/index/classes/CachedMap)\<`number`, `Omit`\<[`HistoryStep`](/pixi-vn/index/interfaces/HistoryStep), `"diff"`>>

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:142](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L142)

Map that contains all information about the steps in the history.

**Don't edit unless you're sure what you're doing.**

## Methods [#methods]

### add() [#add]

\> **add**(`historyInfo?`, `opstions?`): `Promise`\<`void`>

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:98](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L98)

Add a step to the history.

#### Parameters [#parameters-1]

##### historyInfo? [#historyinfo]

`HistoryInfo`

Info about the step to add.

##### opstions? [#opstions]

Options to add the step.

###### ignoreSameStep? [#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 [#returns-4]

`Promise`\<`void`>

***

### blockGoBack() [#blockgoback]

\> **blockGoBack**(): `void`

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:85](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L85)

Block the go back function.

#### Returns [#returns-5]

`void`

***

### clear() [#clear]

\> **clear**(): `void`

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:110](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L110)

Clear the history.

#### Returns [#returns-6]

`void`

***

### delete() [#delete]

\> **delete**(`stepIndex`): `void`

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:136](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L136)

Remove a step from the history.

#### Parameters [#parameters-2]

##### stepIndex [#stepindex]

`number`

The key (id) of the step to remove.

#### Returns [#returns-7]

`void`

True if the step was removed, false if it was not found.

***

### export() [#export]

\> **export**(): `Promise`\<[`HistoryGameState`](/pixi-vn/index/interfaces/HistoryGameState)>

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:163](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L163)

Export the history to an object.

#### Returns [#returns-8]

`Promise`\<[`HistoryGameState`](/pixi-vn/index/interfaces/HistoryGameState)>

The history in an object.

***

### get() [#get]

\> **get**(`stepIndex`): [`NarrationHistory`](/pixi-vn/index/interfaces/NarrationHistory) | `undefined`

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:130](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L130)

Get a step from the history.

**Note:** If the step not contains any information, this method will return undefined.

#### Parameters [#parameters-3]

##### stepIndex [#stepindex-1]

`number`

The key (id) of the step to get.

#### Returns [#returns-9]

[`NarrationHistory`](/pixi-vn/index/interfaces/NarrationHistory) | `undefined`

The step.

***

### keys() [#keys]

\> **keys**(): `MapIterator`\<`number`>

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:122](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L122)

Get all the keys (id) of the history.

#### Returns [#returns-10]

`MapIterator`\<`number`>

***

### removeNarrativeHistory() [#removenarrativehistory]

\> **removeNarrativeHistory**(`itemsNumber?`): `void`

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:66](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L66)

Delete the narrative history.

#### Parameters [#parameters-4]

##### itemsNumber? [#itemsnumber]

`number`

The number of items to delete. If undefined, all items will be deleted.

#### Returns [#returns-11]

`void`

***

### restore() [#restore]

\> **restore**(`data`): `Promise`\<`void`>

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:168](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/history/interfaces/HistoryManagerInterface.ts#L168)

Restore the history from an object.

#### Parameters [#parameters-5]

##### data [#data]

`object`

The history in an object.

#### Returns [#returns-12]

`Promise`\<`void`>
