diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 523550d..754b7da 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -2,14 +2,21 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command -#[tauri::command] +/*#[tauri::command] fn greet(name: &str) -> String { format!("Hello, {}! You've been greeted from Rust!", name) } +*/ + +#[tauri::command] +fn slice() { + println!("I was invoked from JS!"); +} fn main() { + println!("launched"); tauri::Builder::default() - .invoke_handler(tauri::generate_handler![greet]) + //.invoke_handler(tauri::generate_handler![greet]) .run(tauri::generate_context!()) .expect("error while running tauri application"); } diff --git a/src/index.html b/src/index.html index 708a08f..d2c823f 100644 --- a/src/index.html +++ b/src/index.html @@ -5,7 +5,7 @@
ddqdz
+ diff --git a/src/main.js b/src/main.js index 95a1702..af5aacf 100644 --- a/src/main.js +++ b/src/main.js @@ -1,18 +1,6 @@ const { invoke } = window.__TAURI__.tauri; -let greetInputEl; -let greetMsgEl; - -async function greet() { - // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command - greetMsgEl.textContent = await invoke("greet", { name: greetInputEl.value }); +function myFunction() { + document.getElementById("demo").innerHTML = "Hello World"; + invoke("slice") } - -window.addEventListener("DOMContentLoaded", () => { - greetInputEl = document.querySelector("#greet-input"); - greetMsgEl = document.querySelector("#greet-msg"); - document.querySelector("#greet-form").addEventListener("submit", (e) => { - e.preventDefault(); - greet(); - }); -});