Skip to content

eo-typewriterjs


eo-typewriterjs / TimelineBuilder

Class: TimelineBuilder

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

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:38

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:49

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:61

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:84

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:110

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:136

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:162

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:190

Parameters

ParameterTypeDescription
styleRefTStyleRefThe style reference to apply
rangeTStyleRange | "selection"The 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:214

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:237

Parameters

ParameterTypeDescription
rangeTStyleRange | "selection"The 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:261

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.