-
Notifications
You must be signed in to change notification settings - Fork 12
/
lib.rs
61 lines (58 loc) · 1.62 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
pub use models::*;
use tauri::{
plugin::{Builder, TauriPlugin},
Manager, Runtime,
};
mod commands;
#[cfg(desktop)]
mod desktop;
mod error;
#[cfg(mobile)]
mod mobile;
mod models;
pub mod utils;
pub use error::{Error, Result};
#[cfg(desktop)]
pub use desktop::Clipboard;
#[cfg(mobile)]
pub use mobile::Clipboard;
/// Initializes the plugin.
pub fn init<R: Runtime>() -> TauriPlugin<R> {
Builder::new("clipboard")
.invoke_handler(tauri::generate_handler![
commands::stop_monitor,
commands::start_monitor,
commands::is_monitor_running,
commands::has_text,
commands::has_image,
commands::has_html,
commands::has_rtf,
commands::has_files,
commands::available_types,
commands::read_text,
commands::read_files,
commands::read_files_uris,
commands::read_html,
commands::read_image_base64,
commands::read_image_binary,
commands::read_rtf,
commands::write_text,
commands::write_html,
commands::write_html_and_text,
commands::write_rtf,
commands::write_image_binary,
commands::write_image_base64,
commands::write_files_uris,
commands::write_files,
commands::clear
])
.setup(|app, api| {
#[cfg(mobile)]
let clipboard = mobile::init(app, api)?;
#[cfg(desktop)]
let clipboard = desktop::init(api)?;
app.manage(clipboard);
Ok(())
})
.build()
}