From 7aca25520941d9e32c6c2fa8ae1f090bfccbb425 Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 15 Oct 2024 09:34:52 +0800 Subject: [PATCH] Update readme --- plugins/store/README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/store/README.md b/plugins/store/README.md index 811b00b7..5b60fcd2 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 { LazyStore } from '@tauri-apps/plugin-store' +import { createStore } from '@tauri-apps/plugin-store' -const store = new LazyStore('settings.json') +const store = await createStore('settings.json') await store.set('some-key', { value: 5 }) @@ -100,6 +100,16 @@ However, you can also load them manually later like so: await store.load() ``` +### LazyStore + +There's also a high level API `LazyStore` which only loads the store on first access, note that the options will be ignored if a `Store` with that path has already been created + +```typescript +import { LazyStore } from '@tauri-apps/plugin-store' + +const store = new LazyStore('settings.json') +``` + ## Usage from Rust You can also create `Store` instances directly in Rust: