From 230e6bbdf3646b8ee6ef9f718da9b84c6044a975 Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 10 Oct 2024 13:59:07 +0800 Subject: [PATCH] Apply suggestions from code review --- examples/api/src/views/Store.svelte | 2 +- plugins/store/README.md | 2 +- plugins/store/guest-js/index.ts | 22 ++++------------------ 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/examples/api/src/views/Store.svelte b/examples/api/src/views/Store.svelte index f3300278..6248b009 100644 --- a/examples/api/src/views/Store.svelte +++ b/examples/api/src/views/Store.svelte @@ -57,7 +57,7 @@ async function close() { try { 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) { onMessage(error); } diff --git a/plugins/store/README.md b/plugins/store/README.md index 535f673b..811b00b7 100644 --- a/plugins/store/README.md +++ b/plugins/store/README.md @@ -85,7 +85,7 @@ if (val) { ### 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: diff --git a/plugins/store/guest-js/index.ts b/plugins/store/guest-js/index.ts index 19b6df95..292c5990 100644 --- a/plugins/store/guest-js/index.ts +++ b/plugins/store/guest-js/index.ts @@ -167,10 +167,7 @@ export class LazyStore implements IStore { * A key-value store persisted by the backend layer. */ export class Store extends Resource implements IStore { - private constructor( - rid: number - // private readonly path: string - ) { + private constructor(rid: number) { super(rid) } @@ -188,10 +185,7 @@ export class Store extends Resource implements IStore { path, ...options }) - return new Store( - rid - // path - ) + return new Store(rid) } /** @@ -208,10 +202,7 @@ export class Store extends Resource implements IStore { path, ...options }) - return new Store( - rid - // path - ) + return new Store(rid) } /** @@ -219,12 +210,7 @@ export class Store extends Resource implements IStore { */ static async getStore(path: string): Promise { const rid = await invoke('plugin:store|get_store', { path }) - return rid - ? new Store( - rid - // path - ) - : undefined + return rid ? new Store(rid) : undefined } async set(key: string, value: unknown): Promise {