new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Tauri · Plugins and security · all subjects

store

4 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Store plugin setup - manual installation

To manually install the Store plugin: 1) Run 'cargo add tauri-plugin-store' in the src-tauri folder. 2) Modify lib.rs to add .plugin(tauri_plugin_store::Builder::new().build()) to the tauri::Builder::default(). 3) Install JavaScript bindings using npm install @tauri-apps/plugin-store, yarn add @tauri-apps/plugin-store, pnpm add @tauri-apps/plugin-store, deno add npm:@tauri-apps/plugin-store, or bun add @tauri-apps/plugin-store.

Store JavaScript API usage example

import { load } from '@tauri-apps/plugin-store'; const store = await load('store.json', { autoSave: false }); await store.set('some-key', { value: 5 }); const val = await store.get<{ value: number }>('some-key'); console.log(val); // { value: 5 } await store.save(); Note: When autoSave is set to a number or left empty, the store will save changes to disk after a debounce delay of 100ms by default. If autoSave is false, the store will save upon graceful exit or when save() is manually called.

Store Rust API usage example

use tauri::Wry; use tauri_plugin_store::StoreExt; use serde_json::json; #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() .plugin(tauri_plugin_store::Builder::default().build()) .setup(|app| { let store = app.store("store.json")?; store.set("some-key", json!({ "value": 5 })); let value = store.get("some-key").expect("Failed to get value from store"); println!("{}", value); // {"value":5} store.close_resource(); Ok(()) }) .run(tauri::generate_context!()) .expect("error while running tauri application"); } Note: Values must be serde_json::Value instances to be compatible with JavaScript bindings.

Store plugin migration from v1 and v2

When migrating JavaScript code from Store v1/v2, replace 'import { Store }' with 'import { LazyStore }'. When migrating Rust code, replace the with_store callback pattern with the simpler 'let store = app.store(path)?' and 'store.set()' pattern.

Give your agent this brain