5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-06 05:41:07 +08:00
wails/v3/internal/templates/vanilla/frontend/main.js
Lea Anthony c531c714d4
Update vanilla+js template and dependencies
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.
2023-12-30 21:11:38 +11:00

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;
});