Apply suggestions from code review

pull/1860/head
Tony 8 months ago
parent c7094473eb
commit 230e6bbdf3
No known key found for this signature in database
GPG Key ID: 34BDD3EA27824956

@ -57,7 +57,7 @@
async function close() { async function close() {
try { try {
await store.close(); await store.close();
onMessage("Store is now closed, any new operations will now errors out"); onMessage("Store is now closed, any new operations will error out");
} catch (error) { } catch (error) {
onMessage(error); onMessage(error);
} }

@ -85,7 +85,7 @@ if (val) {
### Persisting Values ### Persisting Values
Modifications mode to the store are automatically saved by defaut Modifications made to the store are automatically saved by default
You can manually save a store with: You can manually save a store with:

@ -167,10 +167,7 @@ export class LazyStore implements IStore {
* A key-value store persisted by the backend layer. * A key-value store persisted by the backend layer.
*/ */
export class Store extends Resource implements IStore { export class Store extends Resource implements IStore {
private constructor( private constructor(rid: number) {
rid: number
// private readonly path: string
) {
super(rid) super(rid)
} }
@ -188,10 +185,7 @@ export class Store extends Resource implements IStore {
path, path,
...options ...options
}) })
return new Store( return new Store(rid)
rid
// path
)
} }
/** /**
@ -208,10 +202,7 @@ export class Store extends Resource implements IStore {
path, path,
...options ...options
}) })
return new Store( return new Store(rid)
rid
// path
)
} }
/** /**
@ -219,12 +210,7 @@ export class Store extends Resource implements IStore {
*/ */
static async getStore(path: string): Promise<Store | undefined> { static async getStore(path: string): Promise<Store | undefined> {
const rid = await invoke<number | null>('plugin:store|get_store', { path }) const rid = await invoke<number | null>('plugin:store|get_store', { path })
return rid return rid ? new Store(rid) : undefined
? new Store(
rid
// path
)
: undefined
} }
async set(key: string, value: unknown): Promise<void> { async set(key: string, value: unknown): Promise<void> {

Loading…
Cancel
Save