Interface: LabelProps<T, StepIdType>
Defined in: src/narration/interfaces/LabelProps.ts:3
Type Parameters
T
T
StepIdType
StepIdType = number
Properties
onLoadingLabel?
> optional onLoadingLabel?: (stepId, label) => void | Promise<void>
Defined in: src/narration/interfaces/LabelProps.ts:44
Is a function that will be executed in 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. It is useful for example to make sure all images used have been cached
Parameters
stepId
StepIdType
Step id
label
T
Label
Returns
void | Promise<void>
Example
newLabel("id", [], {
onLoadingLabel: async (stepId, label) => {
await Assets.load('path/to/image1.png')
await Assets.load('path/to/image2.png')
}
})
onStepEnd?
> optional onStepEnd?: (stepId, label) => void | Promise<void>
Defined in: src/narration/interfaces/LabelProps.ts:65
A function executed after each step. See more <DynamicLink href="/start/labels-advanced#onstepend">here.
Parameters
stepId
StepIdType
Step id
label
T
Label
Returns
void | Promise<void>
Example
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")
}
})
onStepStart?
> optional onStepStart?: (stepId, label) => void | Promise<void>
Defined in: src/narration/interfaces/LabelProps.ts:25
A function executed before each step.
Parameters
stepId
StepIdType
Step id
label
T
Label
Returns
void | Promise<void>
Example
const startLabel = newLabel("start", [
() => {
narration.dialogue = "Step 1"
},
() => {
narration.dialogue = "Step 2"
}
], {
onStepStart: (stepIndex, label) => {
console.log(`Step ${stepIndex} started`)
}
})