Tada?
This commit is contained in:
parent
bb7d09d1ef
commit
311718e6d3
3 changed files with 15 additions and 4 deletions
|
@ -106,7 +106,7 @@ pub fn run() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.plugin(tauri_plugin_fs::init())
|
.plugin(tauri_plugin_fs::init())
|
||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
// app.manage(Mutex::new(door));
|
app.manage(Mutex::new(door));
|
||||||
app.manage(Mutex::new(state));
|
app.manage(Mutex::new(state));
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
|
|
|
@ -72,11 +72,12 @@
|
||||||
↑
|
↑
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<form class="column" id="push-form">
|
<form class="column" id="pull-form">
|
||||||
<button type="submit">
|
<button type="submit">
|
||||||
↓
|
↓
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
|
<p id="pull-msg"></p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
14
src/main.js
14
src/main.js
|
@ -1,14 +1,24 @@
|
||||||
const { invoke } = window.__TAURI__.core;
|
const { invoke } = window.__TAURI__.core;
|
||||||
|
|
||||||
let cntMsgEl;
|
let cntMsgEl;
|
||||||
|
let pullMsgEl;
|
||||||
|
|
||||||
async function swap(s) {
|
async function swap(s) {
|
||||||
await invoke("swap", { store: s });
|
await invoke("swap", { store: s });
|
||||||
cntMsgEl.textContent = await invoke("count", {});
|
cntMsgEl.textContent = await invoke("count", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function push() {
|
||||||
|
await invoke("push_data", {});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function pull() {
|
||||||
|
pullMsgEl.textContent = await invoke("pull_data", {});
|
||||||
|
}
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
cntMsgEl = document.querySelector("#cnt-msg");
|
cntMsgEl = document.querySelector("#cnt-msg");
|
||||||
|
pullMsgEl = document.querySelector("#pull-msg");
|
||||||
document.querySelector("#aldi-form").addEventListener("submit", (e) => {
|
document.querySelector("#aldi-form").addEventListener("submit", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
swap("aldi");
|
swap("aldi");
|
||||||
|
@ -35,10 +45,10 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
});
|
});
|
||||||
document.querySelector("#push-form").addEventListener("submit", (e) => {
|
document.querySelector("#push-form").addEventListener("submit", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
await invoke("push_data");
|
push();
|
||||||
});
|
});
|
||||||
document.querySelector("#pull-form").addEventListener("submit", (e) => {
|
document.querySelector("#pull-form").addEventListener("submit", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
cntMsgEl.textContent = await await invoke("pull_data", {});
|
pull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue