chore(store): update example in README.md (#1176)

pull/502/head
zenitogr 1 year ago committed by GitHub
parent 2b0cd3d882
commit 9144521b90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -50,15 +50,20 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
```typescript
import { Store } from "tauri-plugin-store-api";
const store = new Store(".settings.dat");
await store.set("some-key", { value: 5 });
const val = await store.get("some-key");
assert(val, { value: 5 });
const val = await store.get<{ value: number }>("some-key");
if (val) {
console.log(val);
} else {
console.log("val is null");
}
await store.save(); // this manually saves the store, otherwise the store is only saved when your app is closed
```

Loading…
Cancel
Save