# Abstract Class: LabelAbstract<TLabel, TProps, StepIdType> (/jsdoc/pixi-vn/index/classes/LabelAbstract)



Defined in: [src/narration/classes/LabelAbstract.ts:6](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/narration/classes/LabelAbstract.ts#L6)

Extended by [#extended-by]

* [`Label`](/jsdoc/pixi-vn/index/classes/Label)

Type Parameters [#type-parameters]

TLabel [#tlabel]

`TLabel`

TProps [#tprops]

`TProps` *extends* `object` = \{ }

StepIdType [#stepidtype]

`StepIdType` = `number`

Implements [#implements]

* [`LabelProps`](/jsdoc/pixi-vn/index/interfaces/LabelProps)\<`TLabel`, `StepIdType`>

Constructors [#constructors]

Constructor [#constructor]

\> **new LabelAbstract**\<`TLabel`, `TProps`, `StepIdType`>(`id`, `props?`): `LabelAbstract`\<`TLabel`, `TProps`, `StepIdType`>

Defined in: [src/narration/classes/LabelAbstract.ts:13](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/narration/classes/LabelAbstract.ts#L13)

Parameters [#parameters]

id [#id]

`string`

is the id of the label

props? [#props]

[`LabelProps`](/jsdoc/pixi-vn/index/interfaces/LabelProps)\<`TLabel`, `StepIdType`>

is the properties of the label

Returns [#returns]

`LabelAbstract`\<`TLabel`, `TProps`, `StepIdType`>

Properties [#properties]

id [#id-1]

\> `readonly` **id**: `string`

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

Get the id of the label. This variable is used in the system to get the label by id, [RegisteredLabels.get](/jsdoc/pixi-vn/index/namespaces/RegisteredLabels/functions/get)

Accessors [#accessors]

onLoadingLabel [#onloadinglabel]

Get Signature [#get-signature]

\> **get** **onLoadingLabel**(): ((`stepId`, `label`) => `void` | `Promise`\<`void`>) | `undefined`

Defined in: [src/narration/classes/LabelAbstract.ts:61](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/narration/classes/LabelAbstract.ts#L61)

Is a function that will be executed in [onStepStart](/jsdoc/pixi-vn/index/interfaces/LabelProps#onstepstart) if the id of the step is 0
and when the user laods a save file.
When you load a save file, will be executed all onLoadingLabel functions of the [narration.openedLabels](/jsdoc/pixi-vn/index/interfaces/NarrationManagerInterface#openedlabels).
It is useful for example to make sure all images used have been cached

Example [#example]

```ts
newLabel("id", [], {
    onLoadingLabel: async (stepId, label) => {
        await Assets.load('path/to/image1.png')
        await Assets.load('path/to/image2.png')
    }
})
```

Returns [#returns-1]

((`stepId`, `label`) => `void` | `Promise`\<`void`>) | `undefined`

Is a function that will be executed in [onStepStart](/jsdoc/pixi-vn/index/interfaces/LabelProps#onstepstart) if the id of the step is 0
and when the user laods a save file.
When you load a save file, will be executed all onLoadingLabel functions of the [narration.openedLabels](/jsdoc/pixi-vn/index/interfaces/NarrationManagerInterface#openedlabels).
It is useful for example to make sure all images used have been cached

Example [#example-1]

```ts
newLabel("id", [], {
    onLoadingLabel: async (stepId, label) => {
        await Assets.load('path/to/image1.png')
        await Assets.load('path/to/image2.png')
    }
})
```

Implementation of [#implementation-of]

[`LabelProps`](/jsdoc/pixi-vn/index/interfaces/LabelProps).[`onLoadingLabel`](/jsdoc/pixi-vn/index/interfaces/LabelProps#onloadinglabel)

***

onStepEnd [#onstepend]

Get Signature [#get-signature-1]

\> **get** **onStepEnd**(): ((`stepId`, `label`) => `void` | `Promise`\<`void`>) | `undefined`

Defined in: [src/narration/classes/LabelAbstract.ts:68](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/narration/classes/LabelAbstract.ts#L68)

A function executed after each `step`. See more \<DynamicLink href="/start/labels-advanced#onstepend">here</DynamicLink>.

Example [#example-2]

```ts
const startLabel = newLabel("start", [
    async () => {
        await showImage("image1", "path/to/image1.png")
        await showImage("image2", "path/to/image2.png")
    }
], {
    onLoadingLabel: async (stepIndex, label) => {
        await Assets.load("path/to/image1.png")
        await Assets.load("path/to/image2.png")
    }
})
```

Returns [#returns-2]

((`stepId`, `label`) => `void` | `Promise`\<`void`>) | `undefined`

A function executed after each `step`. See more \<DynamicLink href="/start/labels-advanced#onstepend">here</DynamicLink>.

Example [#example-3]

```ts
const startLabel = newLabel("start", [
    async () => {
        await showImage("image1", "path/to/image1.png")
        await showImage("image2", "path/to/image2.png")
    }
], {
    onLoadingLabel: async (stepIndex, label) => {
        await Assets.load("path/to/image1.png")
        await Assets.load("path/to/image2.png")
    }
})
```

Implementation of [#implementation-of-1]

[`LabelProps`](/jsdoc/pixi-vn/index/interfaces/LabelProps).[`onStepEnd`](/jsdoc/pixi-vn/index/interfaces/LabelProps#onstepend)

***

onStepStart [#onstepstart]

Get Signature [#get-signature-2]

\> **get** **onStepStart**(): ((`stepId`, `label`) => `void` | `Promise`\<`void`>) | `undefined`

Defined in: [src/narration/classes/LabelAbstract.ts:45](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/narration/classes/LabelAbstract.ts#L45)

A function executed before each `step`.

Example [#example-4]

```ts
const startLabel = newLabel("start", [
    () => {
        narration.dialogue = "Step 1"
    },
    () => {
        narration.dialogue = "Step 2"
    }
], {
    onStepStart: (stepIndex, label) => {
        console.log(`Step ${stepIndex} started`)
    }
})
```

Returns [#returns-3]

((`stepId`, `label`) => `void` | `Promise`\<`void`>) | `undefined`

A function executed before each `step`.

Example [#example-5]

```ts
const startLabel = newLabel("start", [
    () => {
        narration.dialogue = "Step 1"
    },
    () => {
        narration.dialogue = "Step 2"
    }
], {
    onStepStart: (stepIndex, label) => {
        console.log(`Step ${stepIndex} started`)
    }
})
```

Implementation of [#implementation-of-2]

[`LabelProps`](/jsdoc/pixi-vn/index/interfaces/LabelProps).[`onStepStart`](/jsdoc/pixi-vn/index/interfaces/LabelProps#onstepstart)

***

stepCount [#stepcount]

Get Signature [#get-signature-3]

\> **get** `abstract` **stepCount**(): `number`

Defined in: [src/narration/classes/LabelAbstract.ts:29](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/narration/classes/LabelAbstract.ts#L29)

Get the number of steps in the label. This variable is used in the system to get the number of steps in the label.

Returns [#returns-4]

`number`

The number of steps in the label

Methods [#methods]

getStepById() [#getstepbyid]

\> `abstract` **getStepById**(`stepId`): [`StepLabelType`](/jsdoc/pixi-vn/index/type-aliases/StepLabelType)\<`TProps`> | `undefined`

Defined in: [src/narration/classes/LabelAbstract.ts:42](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/narration/classes/LabelAbstract.ts#L42)

Get the step by id

Parameters [#parameters-1]

stepId [#stepid]

`StepIdType`

Id of the step

Returns [#returns-5]

[`StepLabelType`](/jsdoc/pixi-vn/index/type-aliases/StepLabelType)\<`TProps`> | `undefined`

The step or undefined if it does not exist

***

getStepSha() [#getstepsha]

\> `abstract` **getStepSha**(`stepId`): `string` | `undefined`

Defined in: [src/narration/classes/LabelAbstract.ts:35](https://github.com/DRincs-Productions/pixi-vn/blob/998c1a75c5978f24c0dc137af5f42b90b2803967/src/narration/classes/LabelAbstract.ts#L35)

Get the sha of the step

Parameters [#parameters-2]

stepId [#stepid-1]

`StepIdType`

Returns [#returns-6]

`string` | `undefined`
