more docs

This commit is contained in:
Tony
2024-10-03 16:22:07 +08:00
parent d22de0257d
commit a3bef84382
2 changed files with 11 additions and 7 deletions
+10 -6
View File
@@ -45,15 +45,9 @@ export async function getStore(path: string): Promise<Store | undefined> {
/**
* A lazy loaded key-value store persisted by the backend layer.
*
* Note that the options are not applied if someone else already created the store
*/
export class LazyStore implements IStore {
private _store?: Promise<Store>
constructor(
private readonly path: string,
private readonly options?: StoreOptions
) {}
private get store(): Promise<Store> {
if (!this._store) {
@@ -64,6 +58,16 @@ export class LazyStore implements IStore {
return this._store
}
/**
* Note that the options are not applied if someone else already created the store
* @param path: Path to save the store in `app_data_dir`
* @param options: Store configuration options
*/
constructor(
private readonly path: string,
private readonly options?: StoreOptions
) {}
/**
* Init/load the store if it's not already
*/