mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-08-29 19:50:42 +02:00
Enable auto save by default
This commit is contained in:
@@ -66,7 +66,7 @@ impl<R: Runtime> StoreBuilder<R> {
|
||||
defaults: None,
|
||||
serialize: default_serialize,
|
||||
deserialize: default_deserialize,
|
||||
auto_save: None,
|
||||
auto_save: Some(Duration::from_millis(100)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +167,24 @@ impl<R: Runtime> StoreBuilder<R> {
|
||||
self
|
||||
}
|
||||
|
||||
/// Auto save on modified with a debounce duration
|
||||
///
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// tauri::Builder::default()
|
||||
/// .plugin(tauri_plugin_store::Builder::default().build())
|
||||
/// .setup(|app| {
|
||||
/// let store = tauri_plugin_store::StoreBuilder::new(app, "store.json")
|
||||
/// .auto_save(std::time::Duration::from_millis(100))
|
||||
/// .build()?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
pub fn disable_auto_save(mut self) -> Self {
|
||||
self.auto_save = None;
|
||||
self
|
||||
}
|
||||
|
||||
/// Builds the [`Store`].
|
||||
///
|
||||
/// # Examples
|
||||
|
||||
Reference in New Issue
Block a user