From 53f63f71a035c48458226ed1192d8c1c8631af7a Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Sat, 3 Dec 2022 00:16:46 +0100 Subject: [PATCH] examples/customlayout: feature: add event listener for enter key (#2176) --- v2/examples/customlayout/myfrontend/src/main.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/v2/examples/customlayout/myfrontend/src/main.js b/v2/examples/customlayout/myfrontend/src/main.js index 4ad5a2cae..6cb4ad78d 100644 --- a/v2/examples/customlayout/myfrontend/src/main.js +++ b/v2/examples/customlayout/myfrontend/src/main.js @@ -2,7 +2,7 @@ import './style.css'; import './app.css'; import logo from './assets/images/logo-universal.png'; -import {Greet} from '../wailsjs/go/main/App'; +import { Greet } from '../wailsjs/go/main/App'; document.querySelector('#app').innerHTML = ` @@ -14,6 +14,11 @@ document.querySelector('#app').innerHTML = ` `; document.getElementById('logo').src = logo; +document.addEventListener("keydown", (e) => { + if (e.code === "Enter") { + window.greet(); + } +}); let nameElement = document.getElementById("name"); nameElement.focus();