wip: updater
This commit is contained in:
parent
893a6d0631
commit
fd2cbca34d
4 changed files with 53 additions and 2 deletions
|
@ -20,9 +20,10 @@ wasm-bindgen-test = "0.3.33"
|
|||
tauri-sys = { path = ".", features = ["all"] }
|
||||
|
||||
[features]
|
||||
all = ["app", "clipboard", "event", "mocks", "tauri"]
|
||||
all = ["app", "clipboard", "event", "mocks", "tauri", "updater"]
|
||||
app = ["dep:semver"]
|
||||
clipboard = []
|
||||
event = []
|
||||
mocks = []
|
||||
tauri = ["dep:url"]
|
||||
tauri = ["dep:url"]
|
||||
updater = []
|
|
@ -17,6 +17,9 @@ fn Header<G: Html>(cx: Scope) -> View<G> {
|
|||
a(href="/clipboard") {
|
||||
"Clipboard"
|
||||
}
|
||||
a(href="/updater") {
|
||||
"Updater"
|
||||
}
|
||||
a(href="/communication") {
|
||||
"Communication"
|
||||
}
|
||||
|
|
45
examples/api/src/views/updater.rs
Normal file
45
examples/api/src/views/updater.rs
Normal file
|
@ -0,0 +1,45 @@
|
|||
use sycamore::prelude::*;
|
||||
use tauri_sys::clipboard::{read_text, write_text};
|
||||
|
||||
#[component]
|
||||
pub fn Updater<G: Html>(cx: Scope) -> View<G> {
|
||||
// let text = create_signal(cx, "clipboard message".to_string());
|
||||
|
||||
// let write = move |_| {
|
||||
// sycamore::futures::spawn_local_scoped(cx, async move {
|
||||
// write_text(&text.get()).await
|
||||
// // .then(() => {
|
||||
// // onMessage('Wrote to the clipboard')
|
||||
// // })
|
||||
// // .catch(onMessage)
|
||||
// });
|
||||
// };
|
||||
|
||||
// let read = |_| {
|
||||
// sycamore::futures::spawn_local(async move {
|
||||
// let text = read_text().await;
|
||||
|
||||
// log::info!("Read text from clipboard {:?}", text);
|
||||
// // readText()
|
||||
// // .then((contents) => {
|
||||
// // onMessage(`Clipboard contents: ${contents}`)
|
||||
// // })
|
||||
// // .catch(onMessage)
|
||||
// });
|
||||
// };
|
||||
|
||||
// view! { cx,
|
||||
// div(class="flex gap-1") {
|
||||
// input(class="grow input",placeholder="Text to write to the clipboard",bind:value=text)
|
||||
// button(class="btn",type="button",on:click=write) {
|
||||
// "Write"
|
||||
// }
|
||||
// button(class="btn",type="button",on:click=read) {
|
||||
// "Read"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
view! { cx,
|
||||
div(class="updater") { }
|
||||
}
|
||||
}
|
|
@ -10,6 +10,8 @@ pub mod event;
|
|||
pub mod mocks;
|
||||
#[cfg(feature = "tauri")]
|
||||
pub mod tauri;
|
||||
#[cfg(feature = "updater")]
|
||||
pub mod updater;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue