diskfile_history.svelte.ts view source
Stores edit history for a single diskfile.
inheritance
Cell<typeof DiskfileHistoryJson>
path
type DiskfilePath
entries
type Array<HistoryEntry>
max_entries
type number
current_entry
The most recent history entry (by creation timestamp) Since entries are always kept sorted by creation time (newest first), the most recent is always the first element.
type HistoryEntry | null
constructor
type new (options: DiskfileHistoryOptions): DiskfileHistory
options
add_entry
Add a new history entry.
type (content: string, options?: { is_disk_change?: boolean | undefined; is_unsaved_edit?: boolean | undefined; is_original_state?: boolean | undefined; label?: string | undefined; created?: number | undefined; }): { ...; }
content
stringoptions
{ is_disk_change?: boolean | undefined; is_unsaved_edit?: boolean | undefined; is_original_state?: boolean | undefined; label?: string | undefined; created?: number | undefined; }EMPTY_OBJECT{ id: string & $brand<"Uuid">; created: number; content: string; label: string; is_disk_change: boolean; is_unsaved_edit: boolean; is_original_state: boolean; }find_entry_by_id
Find a history entry by id.
type (id: string & $brand<"Uuid">): { id: string & $brand<"Uuid">; created: number; content: string; label: string; is_disk_change: boolean; is_unsaved_edit: boolean; is_original_state: boolean; } | undefined
id
string & $brand<"Uuid">{ id: string & $brand<"Uuid">; created: number; content: string; label: string; is_disk_change: boolean; is_unsaved_edit: boolean; is_original_state: boolean; } | undefinedget_content
Get the content of a specific history entry.
type (id: string & $brand<"Uuid">): string | null
id
string & $brand<"Uuid">string | nullclear_except_current
Clear all history entries except the most recent one by creation time and any entries that match the optional keep predicate.
type (keep?: ((entry: { id: string & $brand<"Uuid">; created: number; content: string; label: string; is_disk_change: boolean; is_unsaved_edit: boolean; is_original_state: boolean; }) => boolean) | undefined): void
keep?
((entry: { id: string & $brand<"Uuid">; created: number; content: string; label: string; is_disk_change: boolean; is_unsaved_edit: boolean; is_original_state: boolean; }) => boolean) | undefinedvoid