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



Defined in: [src/history/interfaces/HistoryManagerInterface.ts:12](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L12)

Properties [#properties]

back [#back]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:46](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L46)

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`](/jsdoc/pixi-vn/index/type-aliases/StepLabelResultType)>

***

canGoBack [#cangoback]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:62](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L62)

Return true if it is possible to go back.

***

currentLabelHistory [#currentlabelhistory]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:23](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L23)

Get the history of the latest steps belonging to the current label and its child labels.

Returns [#returns-1]

the history of the dialogues, choices and steps

***

diffMap [#diffmap]

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

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

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.**

***

lastKey [#lastkey]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:91](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L91)

Get the last key (id) of the history.

***

narrationMap [#narrationmap]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:128](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L128)

Map that contains all the narration history.

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

***

narrativeHistory [#narrativehistory]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:17](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L17)

Get the narrative history.

Returns [#returns-2]

the history of the dialogues, choices and steps

***

size [#size]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:87](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L87)

Number of items in the history.

***

stepLimitSaved [#steplimitsaved]

\> **stepLimitSaved**: `number`

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:34](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L34)

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`](/jsdoc/pixi-vn/index/classes/CachedMap)\<`number`, `Omit`\<[`HistoryStep`](/jsdoc/pixi-vn/index/interfaces/HistoryStep), `"diff"`>>

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:115](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L115)

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?`): `void`

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:71](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L71)

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-3]

`void`

***

blockGoBack() [#blockgoback]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:58](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L58)

Block the go back function.

Returns [#returns-4]

`void`

***

clear() [#clear]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:83](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L83)

Clear the history.

Returns [#returns-5]

`void`

***

delete() [#delete]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:109](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L109)

Remove a step from the history.

Parameters [#parameters-2]

stepIndex [#stepindex]

`number`

The key (id) of the step to remove.

Returns [#returns-6]

`void`

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

***

export() [#export]

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

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

Export the history to an object.

Returns [#returns-7]

[`HistoryGameState`](/jsdoc/pixi-vn/index/interfaces/HistoryGameState)

The history in an object.

***

get() [#get]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:103](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L103)

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-8]

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

The step.

***

keys() [#keys]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:95](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L95)

Get all the keys (id) of the history.

Returns [#returns-9]

`MapIterator`\<`number`>

***

removeNarrativeHistory() [#removenarrativehistory]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:39](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L39)

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-10]

`void`

***

restore() [#restore]

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

Defined in: [src/history/interfaces/HistoryManagerInterface.ts:141](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/history/interfaces/HistoryManagerInterface.ts#L141)

Restore the history from an object.

Parameters [#parameters-5]

data [#data]

`object`

The history in an object.

Returns [#returns-11]

`Promise`\<`void`>
