mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-30 17:48:50 +02:00
Update readme
This commit is contained in:
+12
-2
@@ -68,9 +68,9 @@ fn main() {
|
|||||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||||
|
|
||||||
```typescript
|
```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 })
|
await store.set('some-key', { value: 5 })
|
||||||
|
|
||||||
@@ -100,6 +100,16 @@ However, you can also load them manually later like so:
|
|||||||
await store.load()
|
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
|
## Usage from Rust
|
||||||
|
|
||||||
You can also create `Store` instances directly in Rust:
|
You can also create `Store` instances directly in Rust:
|
||||||
|
|||||||
Reference in New Issue
Block a user