Update readme

This commit is contained in:
Tony
2024-10-15 09:34:52 +08:00
parent 3127ce562b
commit 7aca255209
+12 -2
View File
@@ -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: