PrivatecurrentPrivatecursorPrivatedbPrivatehistoryPrivateinitializedAdds a command to the history.
The command is stored both in memory and persisted to IndexedDB. Empty commands and consecutive duplicates are ignored.
The command to add to history
A promise that resolves when the command has been persisted
Clears all history from both memory and IndexedDB.
A promise that resolves when the history has been cleared
Returns a copy of all commands in history.
An array of all stored commands, oldest first
Initializes the history store by opening IndexedDB and loading existing history.
This method must be called before using other methods. It loads any previously stored commands from IndexedDB. If IndexedDB is unavailable (e.g., in private browsing), the store falls back to in-memory storage.
A promise that resolves when initialization is complete
PrivateloadLoad history from IndexedDB
Navigates to the next command in history.
When reaching the end of history, returns the previously saved current input.
The next command, the saved current input if at the end, or null if beyond
PrivateopenOpen IndexedDB database
Navigates to the previous command in history.
When called from the end of history (most recent position), this method saves the current input so it can be restored when navigating forward.
The current input buffer content to preserve
The previous command, or null if at the beginning of history
Resets the history cursor to the end and clears the saved current input.
This should be called after a command is executed to prepare for new navigation.
PrivatesaveSave command to IndexedDB
PrivatetrimTrim history in IndexedDB to max size.
Uses a single transaction for all deletions for better performance.
A persistent command history store backed by IndexedDB.
Features:
Example: Basic usage
Example: With input preservation