From 311806929731ac1a53e605c1b454e1630d487dc1 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sat, 10 Aug 2024 19:22:19 +0200 Subject: [PATCH] Implement refresh on ctrl-r and close on ctrl-w --- app.go | 6 ++++++ frontend/index.html | 13 ++++++++----- frontend/src/App.svelte | 23 ++++++++++++++++++----- frontend/wailsjs/go/main/App.d.ts | 2 ++ frontend/wailsjs/go/main/App.js | 4 ++++ 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/app.go b/app.go index aa26e97..abbf3e1 100644 --- a/app.go +++ b/app.go @@ -2,6 +2,7 @@ package main import ( "context" + "os" ) // App struct @@ -135,3 +136,8 @@ func (a *App) SetSetting(key string, value int64) WailsGenericAck { } return WailsGenericAck{Success: true} } + +//region other +func (a *App) Close() { + os.Exit(0) +} \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html index e660485..600e5b3 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,12 +1,15 @@ + - - + + calorie-counter + -
- +
+ - + + \ No newline at end of file diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 0eb3f4a..febf48a 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -1,13 +1,26 @@ + + diff --git a/frontend/wailsjs/go/main/App.d.ts b/frontend/wailsjs/go/main/App.d.ts index d1f690f..1b47a0c 100644 --- a/frontend/wailsjs/go/main/App.d.ts +++ b/frontend/wailsjs/go/main/App.d.ts @@ -2,6 +2,8 @@ // This file is automatically generated. DO NOT EDIT import {main} from '../models'; +export function Close():Promise; + export function CreateFood(arg1:main.Food):Promise; export function CreateWeight(arg1:main.Weight):Promise; diff --git a/frontend/wailsjs/go/main/App.js b/frontend/wailsjs/go/main/App.js index 777c883..f05536d 100644 --- a/frontend/wailsjs/go/main/App.js +++ b/frontend/wailsjs/go/main/App.js @@ -2,6 +2,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export function Close() { + return window['go']['main']['App']['Close'](); +} + export function CreateFood(arg1) { return window['go']['main']['App']['CreateFood'](arg1); }