mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-10 14:13:55 +02:00
Add close store
This commit is contained in:
@@ -463,6 +463,18 @@ impl<R: Runtime> Store<R> {
|
||||
self.store.lock().unwrap().save()
|
||||
}
|
||||
|
||||
pub fn close_store(self) {
|
||||
let store = self.store.lock().unwrap();
|
||||
let app = store.app.clone();
|
||||
let collection = app.state::<StoreCollection>();
|
||||
let stores = collection.stores.lock().unwrap();
|
||||
if let Some(rid) = stores.get(&store.path).copied() {
|
||||
drop(store);
|
||||
drop(stores);
|
||||
let _ = app.resources_table().take::<Store<R>>(rid);
|
||||
}
|
||||
}
|
||||
|
||||
fn trigger_auto_save(&self) -> crate::Result<()> {
|
||||
let Some(auto_save_delay) = self.auto_save else {
|
||||
return Ok(());
|
||||
|
||||
Reference in New Issue
Block a user