mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-24 17:20:51 +02:00
refactor(store): more reworks
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use serde_json::json;
|
||||
use tauri::Listener;
|
||||
use tauri_plugin_store::StoreExt;
|
||||
|
||||
mod app;
|
||||
@@ -22,13 +23,13 @@ fn main() {
|
||||
.handle()
|
||||
.store_builder("settings.json")
|
||||
.auto_save(Duration::from_millis(100))
|
||||
.build();
|
||||
|
||||
// If there are no saved settings yet, this will return an error so we ignore the return value.
|
||||
let _ = store.load();
|
||||
|
||||
.build()
|
||||
.unwrap();
|
||||
app.share_store(store.clone());
|
||||
app.listen("store://change", |event| {
|
||||
dbg!(event);
|
||||
});
|
||||
let app_settings = AppSettings::load_from_store(&store);
|
||||
|
||||
match app_settings {
|
||||
Ok(app_settings) => {
|
||||
let theme = app_settings.theme;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"version": "0.1.0",
|
||||
"identifier": "com.tauri.app-settings-manager",
|
||||
"build": {
|
||||
"devUrl": "http://localhost:1420",
|
||||
"frontendDist": "../dist"
|
||||
},
|
||||
"app": {
|
||||
|
||||
Reference in New Issue
Block a user