refactor: move fs-watch to fs (#369)

This commit is contained in:
Lucas Fernandes Nogueira
2023-05-17 22:50:45 -03:00
committed by GitHub
parent b064718f32
commit ac76abcebd
22 changed files with 52 additions and 1689 deletions
+11 -1
View File
@@ -12,6 +12,8 @@ mod commands;
mod config;
mod error;
mod scope;
#[cfg(feature = "watch")]
mod watcher;
pub use config::Config;
pub use error::Error;
@@ -47,7 +49,11 @@ pub fn init<R: Runtime>() -> TauriPlugin<R, Option<Config>> {
commands::remove_file,
commands::rename_file,
commands::exists,
commands::metadata
commands::metadata,
#[cfg(feature = "watch")]
watcher::watch,
#[cfg(feature = "watch")]
watcher::unwatch
])
.setup(|app: &tauri::AppHandle<R>, api| {
let default_scope = FsScope::default();
@@ -58,6 +64,10 @@ pub fn init<R: Runtime>() -> TauriPlugin<R, Option<Config>> {
.map(|c| &c.scope)
.unwrap_or(&default_scope),
)?);
#[cfg(feature = "watch")]
app.manage(watcher::WatcherCollection::default());
Ok(())
})
.on_event(|app, event| {