Tada?
This commit is contained in:
parent
bb7d09d1ef
commit
311718e6d3
3 changed files with 15 additions and 4 deletions
14
src/main.js
14
src/main.js
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue