TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/pompom454/tea/llms.txt
Use this file to discover all available pages before exploring further.
Engine object drives passage navigation and exposes the runtime lifecycle of a Tea story. It cycles through states — idle, playing, and rendering — as the player moves through passages, and provides methods for programmatically moving backward and forward, jumping to specific moments, and replaying the current passage.
Engine.restart() reloads the browser window immediately with no player prompt. Prefer UI.restart() in most cases, which shows a confirmation dialog before calling Engine.restart().Constants
Engine.State
A pseudo-enumeration representing the possible runtime states of the engine. As passage navigation occurs, the engine cycles: Idle → Playing → Rendering → Playing → Idle.
| Value | Description |
|---|---|
Engine.State.Idle | The engine is waiting for passage navigation to be triggered. This is the default state. |
Engine.State.Playing | Navigation has been triggered; the engine is processing a passage. |
Engine.State.Rendering | The incoming passage is being rendered. This occurs within Playing state. |
Getters
Engine.lastPlay
A timestamp (integer milliseconds) representing the last time
Engine.play() was called.Engine.play() call. Useful for measuring elapsed time since the last navigation.
Engine.state
The current state of the engine as an
Engine.State value.Engine.State enum constants.
Methods
Engine.backward()
true if navigation succeeded; false if already at the beginning of the full history.Engine.forward()
true if navigation succeeded; false if already at the end of the full history.Engine.go(offset)
true if navigation succeeded; false if the offset falls outside the bounds of the full history.An integer offset from the active moment. Positive moves forward, negative moves backward.
Engine.goTo(index)
true if navigation succeeded; false if the index is out of bounds.0 is the oldest (bottommost) moment.
An integer index into the full history.
0 is the least recent moment.Engine.isIdle()
true when the engine is in the Engine.State.Idle state.Engine.isPlaying()
true when passage navigation has been triggered and the engine is processing a turn.Engine.isRendering()
true when the incoming passage is actively being rendered to the DOM.Engine.play(passageName [, noHistory])
The rendered passage
HTMLElement.true as the second argument suppresses that.
The name of the passage to render and display.
When
true, the passage is displayed without adding a moment to the history.Engine.restart()
Causes the browser to immediately reload the window, restarting the story from the beginning. All unsaved state is lost without any player confirmation.
Engine.show()
The rendered passage
HTMLElement.