Skip to content

eo-typewriterjs


eo-typewriterjs / TimelineBuilder

Class: TimelineBuilder ​

Defined in: core/timeline/builders/timeline-builder.ts:29

Description ​

Fluent builder that accumulates user commands into an ordered command list. Commands are not executed immediately - they are compiled and played by the player.

A monotonic version counter is incremented whenever commands are appended, allowing playback controllers to detect when their compiled cache is stale.

Constructors ​

Constructor ​

ts
new TimelineBuilder(): TimelineBuilder;

Returns ​

TimelineBuilder

Accessors ​

commands ​

Get Signature ​

ts
get commands(): readonly TCommand[];

Defined in: core/timeline/builders/timeline-builder.ts:39

Description ​

Return a read-only view of the accumulated commands

Returns ​

readonly TCommand[]

The current list of commands


version ​

Get Signature ​

ts
get version(): number;

Defined in: core/timeline/builders/timeline-builder.ts:50

Description ​

Monotonically increasing version counter. Incremented on every command append.

Returns ​

number

The current version number

Methods ​

wait() ​

ts
wait(duration, options?): this;

Defined in: core/timeline/builders/timeline-builder.ts:62

Parameters ​

ParameterTypeDescription
durationnumberThe duration to wait in milliseconds
options?TCommandHookOptionsOptional lifecycle hooks (before, after)

Returns ​

this

This builder instance for future chaining

Description ​

Schedule a wait command that pauses the timeline for a given duration


select() ​

ts
select(count, options?): this;

Defined in: core/timeline/builders/timeline-builder.ts:87

Parameters ​

ParameterTypeDescription
countTSelectValueNumber of units or boundary string
options?TSelectOptionsOptional configuration (advance mode, cursor id, lifecycle hooks)

Returns ​

this

This builder instance for future chaining

Description ​

Schedule a select command that creates a text selection


move() ​

ts
move(offset, options?): this;

Defined in: core/timeline/builders/timeline-builder.ts:116

Parameters ​

ParameterTypeDescription
offsetTMoveValueNumber of units to move or boundary string
options?TMoveOptionsOptional configuration (advance mode, cursor id, lifecycle hooks)

Returns ​

this

This builder instance for future chaining

Description ​

Schedule a move command that moves the cursor


delete() ​

ts
delete(count, options?): this;

Defined in: core/timeline/builders/timeline-builder.ts:145

Parameters ​

ParameterTypeDescription
countTDeleteValueNumber of units or boundary string
options?TDeleteOptionsOptional delete configuration (advance mode, interval, cursor, lifecycle hooks)

Returns ​

this

This builder instance for future chaining

Description ​

Schedule a delete command that removes text


type() ​

ts
type(text, options?): this;

Defined in: core/timeline/builders/timeline-builder.ts:174

Parameters ​

ParameterTypeDescription
textstringThe text to type
options?TTypeOptionsOptional typing configuration (advance mode, interval, style, cursor, lifecycle hooks)

Returns ​

this

This builder instance for future chaining

Description ​

Schedule a type command that inserts text into the document


style() ​

ts
style(
   styleRef, 
   range, 
   options?
): this;

Defined in: core/timeline/builders/timeline-builder.ts:204

Parameters ​

ParameterTypeDescription
styleRefTStyleRefThe style reference to apply
range"selection" | TStyleRangeThe target range
options?TStyleOptionsOptional configuration (cursor id, lifecycle hooks)

Returns ​

this

This builder instance for future chaining

Description ​

Schedule a style command that applies a style to a document range or cursor selection


unselect() ​

ts
unselect(options?): this;

Defined in: core/timeline/builders/timeline-builder.ts:230

Parameters ​

ParameterTypeDescription
options?TUnselectOptionsOptional configuration (cursor id, lifecycle hooks)

Returns ​

this

This builder instance for future chaining

Description ​

Schedule an unselect command that removes the active text selection


unstyle() ​

ts
unstyle(range, options?): this;

Defined in: core/timeline/builders/timeline-builder.ts:253

Parameters ​

ParameterTypeDescription
range"selection" | TStyleRangeThe target range
options?TUnstyleOptionsOptional configuration (cursor id, lifecycle hooks)

Returns ​

this

This builder instance for future chaining

Description ​

Schedule an unstyle command that removes styles overlapping a document range or cursor selection


call() ​

ts
call(callback, options?): this;

Defined in: core/timeline/builders/timeline-builder.ts:279

Parameters ​

ParameterTypeDescription
callbackTCallbackFnThe function to invoke
options?TCommandHookOptionsOptional lifecycle hooks (before, after)

Returns ​

this

This builder instance for future chaining

Description ​

Schedule a call command that invokes a callback function as a named step in the timeline

Released under the MIT License.