mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-06 05:41:07 +08:00

The frontend interaction has been significantly updated, including improvements to the Greet function and the addition of an ongoing time display. Additionally, dependencies in package.json have been updated to their latest versions. Also, redundant print statement was removed from messageprocessor_call.go and changes were made to layout structure and styles in the main.go.tmpl and index.html files.
20 lines
535 B
JavaScript
20 lines
535 B
JavaScript
import {Greet} from "./bindings/main/GreetService.js";
|
|
import {Events} from "@wailsio/runtime";
|
|
|
|
window.doGreet = () => {
|
|
let name = document.getElementById('name').value;
|
|
if (!name) {
|
|
name = 'from Go';
|
|
}
|
|
Greet(name).then((result) => {
|
|
let element = document.getElementById('greeting');
|
|
element.innerText = result;
|
|
}).catch((err) => {
|
|
console.log(err);
|
|
});
|
|
}
|
|
|
|
Events.On('time', (time) => {
|
|
let element = document.getElementById('time');
|
|
element.innerText = time.data;
|
|
}); |