This commit is contained in:
Bianca Fürstenau 2025-02-10 14:24:03 +01:00
parent 51c76921a0
commit bb7d09d1ef
6 changed files with 297 additions and 98 deletions

View file

@ -66,5 +66,17 @@
</form>
</main>
<p id="cnt-msg"></p>
<main class="container">
<form class="column" id="push-form">
<button type="submit">
</button>
</form>
<form class="column" id="push-form">
<button type="submit">
</button>
</form>
</main>
</body>
</html>

View file

@ -2,14 +2,9 @@ const { invoke } = window.__TAURI__.core;
let cntMsgEl;
// async function greet() {
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
// greetMsgEl.textContent = await invoke("greet", { name: greetInputEl.value });
//}
async function swap(s) {
invoke("swap", { store: s });
cntMsgEl.textContent = await invoke("pull_data", {});
await invoke("swap", { store: s });
cntMsgEl.textContent = await invoke("count", {});
}
window.addEventListener("DOMContentLoaded", () => {
@ -38,4 +33,12 @@ window.addEventListener("DOMContentLoaded", () => {
e.preventDefault();
swap("tegut");
});
document.querySelector("#push-form").addEventListener("submit", (e) => {
e.preventDefault();
await invoke("push_data");
});
document.querySelector("#pull-form").addEventListener("submit", (e) => {
e.preventDefault();
cntMsgEl.textContent = await await invoke("pull_data", {});
});
});