Constructor
new Typewriter(field)
Creates a typewriter for a bitmap text field.
Parameters:
| Name | Type | Description |
|---|---|---|
field |
rune.text.BitmapField | The target field, retained but not owned. |
- Source:
Members
(readonly) running :boolean
Whether the writer is revealing text.
Type:
- boolean
- Source:
Methods
complete() → {undefined}
Reveals all remaining text and invokes onComplete once if currently running.
Skipped characters do not trigger onCharacter callbacks.
- Source:
Returns:
- Type
- undefined
dispose() → {undefined}
Stops the writer and releases callbacks and its field reference. The field is
not disposed, and its current visible text is retained.
- Source:
Returns:
- Type
- undefined
onCharacter(func, scopeopt) → {undefined}
Registers or clears the per-character callback. Receives the character,
its zero-based source index and the field, including spaces and newlines.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
func |
function | Callback, or null to remove it. | |
scope |
Object |
<optional> |
Callback execution scope. |
- Source:
Returns:
- Type
- undefined
onComplete(func, scopeopt) → {undefined}
Registers or clears the completion callback. Receives the target field.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
func |
function | Callback, or null to remove it. | |
scope |
Object |
<optional> |
Callback execution scope. |
- Source:
Returns:
- Type
- undefined
start(text, intervalopt) → {undefined}
Replaces the field text and starts revealing it after the first interval.
Empty text completes immediately. Callback registrations survive restarts.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
text |
string | The full text to display. | ||
interval |
number |
<optional> |
40 | Positive milliseconds per character. |
- Source:
Returns:
- Type
- undefined
stop() → {undefined}
Stops revealing text, preserving the current visible characters. Does not
invoke onComplete. Assigning different field text stops and reveals it fully.
- Source:
Returns:
- Type
- undefined