mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
feat(clipboard): add plugin (#323)
This commit is contained in:
committed by
GitHub
parent
4539c03f95
commit
8cd7d3501b
@@ -7,6 +7,9 @@ license.workspace = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build.workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
@@ -2,16 +2,14 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use tauri::{AppHandle, command, Runtime, State, Window};
|
||||
use tauri::{AppHandle, command, Runtime, Window};
|
||||
|
||||
use crate::{MyState, Result};
|
||||
use crate::Result;
|
||||
|
||||
#[command]
|
||||
pub(crate) async fn execute<R: Runtime>(
|
||||
_app: AppHandle<R>,
|
||||
_window: Window<R>,
|
||||
state: State<'_, MyState>,
|
||||
) -> Result<String> {
|
||||
state.0.lock().unwrap().insert("key".into(), "value".into());
|
||||
Ok("success".to_string())
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ use tauri::{
|
||||
Manager, Runtime,
|
||||
};
|
||||
|
||||
use std::{collections::HashMap, sync::Mutex};
|
||||
|
||||
pub use models::*;
|
||||
|
||||
#[cfg(desktop)]
|
||||
@@ -27,9 +25,6 @@ use desktop::{{ plugin_name_pascal_case }};
|
||||
#[cfg(mobile)]
|
||||
use mobile::{{ plugin_name_pascal_case }};
|
||||
|
||||
#[derive(Default)]
|
||||
struct MyState(Mutex<HashMap<String, String>>);
|
||||
|
||||
/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the {{ plugin_name }} APIs.
|
||||
pub trait {{ plugin_name_pascal_case }}Ext<R: Runtime> {
|
||||
fn {{ plugin_name_snake_case }}(&self) -> &{{ plugin_name_pascal_case }}<R>;
|
||||
|
||||
Reference in New Issue
Block a user