This commit is contained in:
Bianca Fürstenau 2025-02-10 15:41:50 +01:00
parent bb7d09d1ef
commit 311718e6d3
3 changed files with 15 additions and 4 deletions

View file

@ -106,7 +106,7 @@ pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_fs::init())
.setup(|app| {
// app.manage(Mutex::new(door));
app.manage(Mutex::new(door));
app.manage(Mutex::new(state));
Ok(())
})

View file

@ -72,11 +72,12 @@
</button>
</form>
<form class="column" id="push-form">
<form class="column" id="pull-form">
<button type="submit">
</button>
</form>
</main>
<p id="pull-msg"></p>
</body>
</html>

View file

@ -1,14 +1,24 @@
const { invoke } = window.__TAURI__.core;
let cntMsgEl;
let pullMsgEl;
async function swap(s) {
await invoke("swap", { store: s });
cntMsgEl.textContent = await invoke("count", {});
}
async function push() {
await invoke("push_data", {});
}
async function pull() {
pullMsgEl.textContent = await invoke("pull_data", {});
}
window.addEventListener("DOMContentLoaded", () => {
cntMsgEl = document.querySelector("#cnt-msg");
pullMsgEl = document.querySelector("#pull-msg");
document.querySelector("#aldi-form").addEventListener("submit", (e) => {
e.preventDefault();
swap("aldi");
@ -35,10 +45,10 @@ window.addEventListener("DOMContentLoaded", () => {
});
document.querySelector("#push-form").addEventListener("submit", (e) => {
e.preventDefault();
await invoke("push_data");
push();
});
document.querySelector("#pull-form").addEventListener("submit", (e) => {
e.preventDefault();
cntMsgEl.textContent = await await invoke("pull_data", {});
pull();
});
});