The type of data to be stored and retrieved. Defaults to any
.
Initializes a new instance of the Storage class.
This constructor checks if IndexedDB is supported in the current environment. If not, it throws an error. If supported, it creates a localforage instance with the specified configuration for the SEJ Editor.
Whether debugging is enabled.
Key for the storage.
LocalForage instance for the storage.
Version of the storage.
Clears all items from the storage.
This method removes all key-value pairs from the storage, effectively resetting it to an empty state.
Retrieves data from the storage and optionally executes a callback with the retrieved data.
Optional
callback: (data: T) => voidAn optional callback function that will be called with the retrieved data.
Retrieves an item from the storage asynchronously.
A promise that resolves to the item retrieved from the storage, or null if the item does not exist.
Stores the provided data in IndexedDB and optionally executes a callback function.
The data to be stored.
Optional
callback: () => voidAn optional callback function to be executed after the data is stored.
Asynchronously sets the provided data in the storage.
The data to be stored.
A promise that resolves when the data has been stored.
AbstractStorage is a generic class that provides an interface for storing and retrieving data using IndexedDB through the localForage library. It includes methods for synchronous and asynchronous data retrieval and storage, as well as a method for clearing the storage.