Data Management API
loadData(data: LoadDataFormat): boolean
Loads a full timeline payload. The current implementation clears existing tracks and selection state, then normalizes the input into runtime TimelineEvent objects.
Notes:
- Events can use either
startTime + endTimeorstartTime + duration - If the payload ends up with no tracks,
Timelineadds one empty track - If
timeIndicatorPositionis present, the runtime callssetTimeIndicator()internally
addEvent(...)
Signature:
Notes:
trackIndexmust refer to an existing track- In the public API, the third argument is documented as
endTime - The current implementation tolerates some duration-like inputs, but you should pass a real end time for clarity
updateEvent(trackIndex, eventIndex, updates): boolean
Applies a Partial<TimelineEvent> directly to the runtime event object.
updateEventData(trackIndex, eventIndex, eventData): boolean
A lighter-weight update API for form-driven edits.
deleteEvent(trackIndex, eventIndex): boolean
Deletes an event.
Notes:
- A successful delete triggers
events:delete - If
autoRemoveEmptyLastTrackis enabled, the final empty track may be removed automatically
addTrack(): void
Adds a new empty track.
removeTrack(): void
Removes the last track.
Notes:
- At least one track is always kept
- If removal is not allowed, the runtime updates the status text instead of throwing
autoRemoveEmptyLastTrack(): void
Recursively removes the last track when it is empty and autoRemoveEmptyLastTrack is enabled.
setEndTime(endTime: number): boolean
Updates the timeline end time.
Notes:
endTimemust be greater thanstartTime- If existing events extend beyond the new end time, the runtime warns but does not trim them
- If the time indicator falls out of range, it is clamped to the new
endTime
getEndTime(): number
Returns the current end time.
Index batching
These APIs are mainly useful when you mutate timeline.state.tracks directly or perform large external writes.
beginIndexBatch(): void
endIndexBatch(): void
invalidateIndexTrack(trackIndex: number): void
invalidateIndexAll(): void
If you use public APIs such as
addEvent,updateEvent,deleteEvent, orloadData, index invalidation is already handled for you.