From 975129695ede477b6fe52cf715abf3bd672fe7a4 Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 17 Oct 2024 11:58:40 +0800 Subject: [PATCH] Update docs --- plugins/store/README.md | 4 ++-- plugins/store/guest-js/index.ts | 15 +++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/plugins/store/README.md b/plugins/store/README.md index f6773776..7ab63fd4 100644 --- a/plugins/store/README.md +++ b/plugins/store/README.md @@ -68,9 +68,9 @@ fn main() { Afterwards all the plugin's APIs are available through the JavaScript guest bindings: ```typescript -import { createStore } from '@tauri-apps/plugin-store' +import { Store } from '@tauri-apps/plugin-store' -const store = await createStore('settings.json') +const store = await Store.load('settings.json') await store.set('some-key', { value: 5 }) diff --git a/plugins/store/guest-js/index.ts b/plugins/store/guest-js/index.ts index e9c0a77c..0260f5e4 100644 --- a/plugins/store/guest-js/index.ts +++ b/plugins/store/guest-js/index.ts @@ -65,10 +65,7 @@ export async function create( * @example * ```typescript * import { Store } from '@tauri-apps/api/store'; - * let store = await Store.get('store.json'); - * if (!store) { - * store = await Store.load('store.json'); - * } + * const store = await Store.load('store.json'); * ``` * * @param path Path to save the store in `app_data_dir` @@ -93,10 +90,7 @@ export async function load( * @example * ```typescript * import { getStore } from '@tauri-apps/api/store'; - * let store = await getStore('store.json'); - * if (!store) { - * store = await Store.load('store.json'); - * } + * const store = await getStore('store.json'); * ``` * * @param path Path of the store. @@ -245,10 +239,7 @@ export class Store extends Resource implements IStore { * @example * ```typescript * import { Store } from '@tauri-apps/api/store'; - * let store = await Store.get('store.json'); - * if (!store) { - * store = await Store.load('store.json'); - * } + * const store = await Store.load('store.json'); * ``` * * @param path Path to save the store in `app_data_dir`