fix(lib/json-storage): clarify how JsonStorage.get() and JsonStorageUpdateMode.Load works

This commit is contained in:
PalmDevs 2026-07-28 12:44:31 +07:00
parent 9e2ac7185d
commit e73bbc03ba
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -34,7 +34,8 @@ export const JsonStorageUpdateMode = {
*/
Replace: 1,
/**
* Same behavior as {@link JsonStorageUpdateMode.Replace}, but for the intial load of the storage.
* Same behavior as {@link JsonStorageUpdateMode.Replace}, but for when the storage is being synced from disk.
* E.g. on initial load, or when the storage file is deleted and recreated.
*/
Load: 2,
} as const
@ -221,7 +222,8 @@ export interface JsonStorage<T extends AnyObject> {
*/
subscribe(callback: JsonStorageSubscription<T>): () => void
/**
* Get the storage.
* Reads the storage from disk.
* If the storage does not exist, it will be created with the default value.
*/
get(): Promise<T>
/**