refactor, go work
This commit is contained in:
21
app/frontend/main.js
Normal file
21
app/frontend/main.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import {Greet} from "./bindings/main/BotService.js";
|
||||
import {Events} from "@wailsio/runtime";
|
||||
|
||||
const resultElement = document.getElementById('result');
|
||||
const timeElement = document.getElementById('time');
|
||||
|
||||
window.doGreet = () => {
|
||||
let name = document.getElementById('name').value;
|
||||
if (!name) {
|
||||
name = 'anonymous';
|
||||
}
|
||||
Greet(name).then((result) => {
|
||||
resultElement.innerText = result;
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
Events.On('time', (time) => {
|
||||
timeElement.innerText = time.data;
|
||||
});
|
||||
Reference in New Issue
Block a user