Compare commits

..

118 Commits

Author SHA1 Message Date
Lea Anthony a11655c452 Merge master 2022-07-09 22:55:03 +10:00
Lea Anthony 11cbfb68f1 Merge branch 'master' into exp
# Conflicts:
#	v2/internal/frontend/desktop/windows/win32/consts.go
2022-07-09 22:50:01 +10:00
Lea Anthony 7a63464997 Update vscode template (#1398) 2022-07-08 20:33:49 +10:00
Lea Anthony bf2d83d939 Change: Order of generated bindings now consistent
Closes #1531
2022-07-08 20:18:31 +10:00
Lea Anthony 1cd31573a9 change: improve cli output for wails update
closes #1528
2022-07-08 19:53:13 +10:00
Lea Anthony 39cebffa87 Fix: use correct json value for buildtype 2022-07-08 10:58:38 +10:00
Ian M. Jones f4b4e4cdb8 Allow -appargs flag to pass flags to binary. (#1534) 2022-07-06 19:25:28 +10:00
Lea Anthony 73f5cc3b92 Update issue template with links 2022-07-05 08:50:05 +10:00
Lea Anthony c48ad9be67 doc: white screen fix for Mac. Closes #1508 2022-07-05 08:44:26 +10:00
Lea Anthony 4726b72708 feature: Add -windowsconsole flag 2022-07-04 22:52:50 +10:00
Lea Anthony 4c312b155d [docs] Update -debug flag 2022-07-04 22:33:03 +10:00
Lea Anthony cd35536a79 [linux] Fix SetBackgroundColour 2022-07-04 22:29:51 +10:00
Lea Anthony 91d6c23c71 Updated contribution guide 2022-07-03 15:37:21 +10:00
Lea Anthony 59f84b8905 Development -> Contributing 2022-07-03 14:52:37 +10:00
Lea Anthony a1a06a6198 Initial development guides 2022-07-03 12:06:35 +10:00
Lea Anthony 5292721517 Update Sponsors 2022-07-03 10:19:15 +10:00
stffabi 41d1bf3d10 [v2] Improvements to the dev command (#1510)
* [v2, darwin] Fix nullreference exception when dev watcher failed to start and the user stopped wails dev with ctrl-c

* [v2] Improve starting of dev watcher command

Wails dev now also fails if the dev watcher could not be started. Since
the dev watcher is used to start e.g. vite to serve the frontend, it does
not make much sense to let Wails dev be running if the dev
watcher failed to start.

* [v2] Improve killing and cleanup of debug binary

- Make sure to kill the debug process in all cases even if an error occured.
- Make sure to kill the last started binary process
2022-06-30 20:13:06 +10:00
Lea Anthony 3e42d2da05 Rename WindowSetRGBA -> WindowSetBackgroundColour (#1506)
* Rename WindowSetRGBA -> WindowSetBackgroundColour

* Fix Typos
2022-06-29 22:31:49 +10:00
Lea Anthony 7141c972fd Move WindowGet* to main thread (#1464) 2022-06-29 20:07:16 +10:00
Lea Anthony 7cc3652a39 Updated docs. Closes #1501 2022-06-29 08:08:12 +10:00
Lea Anthony 95082336cd changelog + doc fix 2022-06-27 21:09:07 +10:00
NYSSEN Michaël b2cec41fbf Fix lit-ts template (#1494)
* Fix lit-ts template

* Fixing generate Template

* Remove bad null check

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-06-27 20:56:18 +10:00
Lea Anthony 66f79c2e51 v2.0.0-beta.38 + release script 2022-06-27 20:41:09 +10:00
Lea Anthony f8e6fa4bf3 Regenerate templates 2022-06-27 18:09:25 +10:00
Tom d9888ce6af Chore/react 18 create root (#1489)
* chore: use createRoot for react-ts

* chore: use createRoot for react-js

* fix: quotes

* fix: remove semi

* chore: update react templates to use createRoot instead of ReactDOM.render

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-06-27 18:00:04 +10:00
Lea Anthony 0531645377 Better signal handling (#1488)
* Better signal handling

* Remove waitgroup
2022-06-25 09:26:17 +10:00
Sidharth Rathi c22f59adb9 Update templates.mdx (#1492)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-06-25 09:21:02 +10:00
Nan0 2065600096 Feature: set browser path (#1448)
* Added option to specify webview2 path

* Added `manual` webview strategy

* Update documentation

* Fixed build with manual tag

* Check for browser directory existence

* Added version check for manually specified webview, removed fallback for installed webview in manual strategy

* Update WebviewBrowserPath documentation

* Replaced deprecated StringToUTF16Ptr

* Return on error

* Removed manual strategy, return error in wv2installer for fixed runtime

* Removed manual strategy from CLI
2022-06-25 07:49:00 +10:00
stffabi c61ce1e2de [v2, windows] Make SetBackgroundColour compatible for windows/386 (#1493)
* [v2, windows] Remove duplicate SetBackgroundColour

* [v2, windows] Make SetBackgroundColour compatible for windows/386
2022-06-25 06:46:23 +10:00
Lea Anthony 16581ceff9 Regenerate templates to use BackgroundColour 2022-06-23 20:30:18 +10:00
Lea Anthony beb909fc0f Update README.md 2022-06-22 21:51:21 +10:00
Lea Anthony 5cddf8864e Add roadmap to docs 2022-06-22 21:39:40 +10:00
Lea Anthony e504d1124a Fix AlwaysOnTop code for Mac 2022-06-22 21:36:57 +10:00
dependabot[bot] 91afa396ba Bump shell-quote from 1.7.2 to 1.7.3 in /v2/internal/frontend/runtime (#1485)
Bumps [shell-quote](https://github.com/substack/node-shell-quote) from 1.7.2 to 1.7.3.
- [Release notes](https://github.com/substack/node-shell-quote/releases)
- [Changelog](https://github.com/substack/node-shell-quote/blob/master/CHANGELOG.md)
- [Commits](https://github.com/substack/node-shell-quote/compare/v1.7.2...1.7.3)

---
updated-dependencies:
- dependency-name: shell-quote
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-22 20:56:16 +10:00
dependabot[bot] 08eee061ab Bump shell-quote in /v2/internal/frontend/runtime/dev (#1486)
Bumps [shell-quote](https://github.com/substack/node-shell-quote) from 1.7.2 to 1.7.3.
- [Release notes](https://github.com/substack/node-shell-quote/releases)
- [Changelog](https://github.com/substack/node-shell-quote/blob/master/CHANGELOG.md)
- [Commits](https://github.com/substack/node-shell-quote/compare/v1.7.2...1.7.3)

---
updated-dependencies:
- dependency-name: shell-quote
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-22 20:56:01 +10:00
chenxiao 072929689c feature: add runtime func WindowSetAlwaysOnTop (#1442)
* feature: add runtime func WindowSetAlwaysOnTop

* add runtime WindowSetUnalwaysOnTop

* add  JavaScript runtime method  ,  docs update

* WindowSetAlwaysOnTop(b bool)

* Add AlwaysOnTop for MacOS

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-06-22 20:55:02 +10:00
stffabi 72d019cb48 [v2, windows] Pass the correct installationStatus to the webview installation strategy (#1483)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-06-22 20:50:45 +10:00
Lea Anthony 91ed594049 Update feature request template 2022-06-22 20:46:00 +10:00
stffabi 4493a05fb9 [v2] AssetsHandler remove retry logic in dev mode (#1479) 2022-06-22 20:06:20 +10:00
Lea Anthony f8eac34212 Bugfix: Don't stop if unable to remove temporary bindings build (#1465) 2022-06-22 08:40:30 +10:00
Lea Anthony 1687906376 Improve theme change at runtime (#1473)
* Improve theme change at runtime

* Handle change to dark mode

* Refactor theme calculation

* Ensure theme is updated for WM_ACTIVATE and WM_SETTINGCHANGE events
2022-06-22 08:34:41 +10:00
Lea Anthony 381909696b [Windows] Add Suspend/Resume callback support (#1474)
* Add Suspend/Resume callback support

* Fix comment
2022-06-22 06:37:18 +10:00
Lea Anthony c477100374 Add BackgroundColour and deprecate RGBA (#1475) 2022-06-21 19:47:05 +10:00
Lea Anthony cb169611b1 Set Window Background colour if provided + debounce redraw option (#1466)
* Set Window Background colour if provided. Added debounce option for Webview2 redraw on resize

* [windows] Workaround resize flickering in frameless mode

Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-06-20 17:47:13 +10:00
Lea Anthony 4dd1be5252 Update sponsors 2022-06-19 13:38:25 +10:00
Lea Anthony a7f1ea21ef Bugfix: Better support for showing window 2022-06-19 13:32:48 +10:00
Lea Anthony e4f2bfe699 Bugfix: Windows start maximised
Fixes #1462
2022-06-18 16:21:32 +10:00
Lea Anthony 9bd765d2c8 Update README.md 2022-06-18 15:33:34 +10:00
Lea Anthony d77c556c4e Update Sponsors 2022-06-18 15:31:29 +10:00
Abtin 9a01c757bd Fix apt command syntax (#1458) (#1461) 2022-06-18 09:26:22 +10:00
Andreas Wenk 41051e8848 fix the url to surge (#1460)
fix the url to surge in the docs
2022-06-18 09:24:19 +10:00
stffabi 884773a218 [v2, windows] Fix WebView2 minimum runtime version check (#1456)
* [v2, windows] CompareBrowserVersions needs a int32 pointer

Otherwise 4294967295 will be returned instead of -1 and the
minimum version check can't detect an older version.
So an older version than the minimum might be used and will
result in AccessViolationExceptions.

* [v2, windows] Use the correct minimum runtime version for SDK 1.0.992.28

The Webview2Loader.dll are already at version 1.0.992.28 for all platforms.
2022-06-16 18:43:19 +10:00
Luken 1e54eb2eaf Fix small typo in docs (#1449) 2022-06-13 08:53:49 +10:00
Lea Anthony cb4ba5bca6 Add Typescript troubleshooting guide 2022-06-12 14:57:45 +10:00
stffabi 664f6a952c [v2, windows] Unlock OSThread after native calls have been finished (#1441)
* [v2, windows] Remove unnecessary LockOSThread

Form.Invoke makes sure the call is on the correct thread and does
lock the OSThread during the call.

* [v2, windows] Unlock OSThread after native calls have been finished

This makes sure the OSThread can be reused by other go
routines after a native call has been finished. Otherwise the
OSThread will be destroyed as soon as the goroutine has
finished.
2022-06-08 20:56:07 +10:00
Lea Anthony fe341741b5 Always use return in wrapped method (#1410) 2022-06-06 00:41:44 -10:00
Marcus Crane cd162918d4 Add showcase entry for October + update homepage carousel entry for October (#1436)
* Add showcase entry for October

* Update home carousel image for October
2022-06-02 01:59:33 -10:00
Lea Anthony 6a07cbd505 Move go-common-file-dialog into project. Fix Title bug. 2022-06-01 21:00:52 +10:00
stffabi 614f50d5d3 [v2, windows] Load WebView2 loader from embedded only (#1432) 2022-05-31 10:00:02 -10:00
Jae-Sung Lee f292e221f1 Create gitignore when using g option (#1430)
* Create gitignore when using g option
2022-05-31 20:29:20 +10:00
stffabi 2a0673f99f [v2, linux] Improve switching to main thread for callbacks (#1392)
Make sure no pointers to the stack are passed to g_idle_add,
because at the time the callback gets executed on the
main thread, the pointer might be invalid.
Go might have reused the stack or grown the stack and the
pointer is invalid.

The concept used on Windows has been ported to Linux.
2022-05-31 20:28:37 +10:00
Zámbó, Levente 794a8ce19f feature - support linux/arm (#1427) 2022-05-27 19:09:50 -10:00
Zámbó, Levente f6425a64a6 feature - add race detector to build & dev (#1426) 2022-05-27 19:07:39 -10:00
Lea Anthony b49dce8676 Update Changelog 2022-05-26 17:52:25 -10:00
Lea Anthony 6a88568f0a v2.0.0-beta.37 2022-05-26 17:45:57 -10:00
Edward Browncross a10a9e5b36 Add missing className to input in React and Preact templates (#1419)
* add missing className to input in react and preact templates

* add missing className to input in react and preact assets
2022-05-26 02:56:37 +10:00
刀刀 e7f9e2f267 docs: add macos custom menu EditMenu tips (#1423)
* docs: add macos custom menu EditMenu tips

On macos platform, if custom the menu, we should append EditMenu to enable Cmd+C,Cmd+V,Cmd+Z... shortcut
2022-05-25 08:49:04 +02:00
yuzu 316a24f6da update runtime.d.ts & templates (#1421) 2022-05-24 21:20:53 +02:00
stffabi c874e30339 Merge pull request #1413 from mondy/feature/nogen-flag 2022-05-23 10:40:46 +02:00
mondy 043d83e39e Add nogen flag in cli document. 2022-05-23 09:08:35 +09:00
Blake Bourque 7e64038265 Add blurb on wails generate module (#1414)
For users who wish to keep the wailsjs directory out of source control, the `wails generate module` command is valuable in a CI environment where wails build does not automatically generate the needed javascript module.
2022-05-23 08:43:18 +10:00
mondy d4ecaad0e1 Add nogen flag in wails dev command 2022-05-21 14:22:18 +09:00
Lea Anthony 953bc09343 Merge pull request #1400 from wailsapp/feature/native-translucency
Initial support for new native translucency in Windows Preview
2022-05-18 18:52:45 +10:00
Lea Anthony 935f6871ab Merge pull request #1406 from rayshoo/master
fix typo bindings.js to ipc.js
2022-05-18 17:38:17 +10:00
rayshoo 0d793124fd fix typo bindings.js to ipc.js 2022-05-18 15:58:33 +09:00
stffabi c97e1c50af [v2, linux] Make sure to execute the menu callbacks on a new goroutine (#1403)
* Make sure to execute the menu callbacks on a new goroutine
* Fix assertion message when opening file dialogs by passing the correct parent window
2022-05-17 20:45:48 +10:00
Lea Anthony 319d59296e Support loading images into Windows tray 2022-05-14 06:44:22 +10:00
Lea Anthony 35b1dfdd2a Merge pull request #1394 from LGiki/add-template-nextjs
Add Next.js template
2022-05-13 20:57:32 +10:00
Lea Anthony 368733b7cc WIP 2022-05-13 20:49:54 +10:00
LGiki e705c20de9 Add Next.js template 2022-05-13 14:33:07 +08:00
stffabi ae25b38f9e Merge pull request #1393 from LGiki/fix-typo-in-docs 2022-05-12 12:52:15 +02:00
LGiki ec2202765c fix: typo in docs 2022-05-12 09:50:16 +08:00
Lea Anthony e0e55e6e76 Better website spacing 2022-05-11 20:18:53 +10:00
Lea Anthony 4d5f31ab84 Merge pull request #1391 from wailsapp/bugfix/typo
bugfix: correct typo
2022-05-11 13:09:23 +10:00
Travis McLane b84fd76e86 bugfix: correct typo 2022-05-10 21:56:19 -05:00
Lea Anthony 55115742c1 fix: TS conversion of interface{} 2022-05-11 08:21:17 +10:00
Lea Anthony f2f8ed2e99 Merge pull request #1390 from lambdajack/v2-events-fix
[v2] Events | fixes #1388
2022-05-10 21:06:53 +10:00
Jack Bizzell d59bec171e Changing all occurrences of calls to OnMultiple() inside EventsOn() and EventsOnce() in the frontend definitions, to calls to EventsOnMultiple()
OnMultiple is undefined
2022-05-09 20:42:40 +01:00
Lea Anthony bff0ece017 Merge pull request #1387 from Junkher/patch-1
Update events.mdx
2022-05-08 04:16:48 +10:00
Junker 7c0d1019f2 Update events.mdx
A little mistake in the arguments of Js EventEmit
2022-05-07 23:12:01 +08:00
Lea Anthony ee5ca1a84a Add SetLabel, minor api updates 2022-05-07 20:39:08 +10:00
Lea Anthony a3de4577dd Update tagline 2022-05-07 12:05:30 +10:00
Lea Anthony 4986f9cea5 Fix docs formatting (#1372)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-05-07 10:36:39 +10:00
Lea Anthony 0f2fc1ab7a Merge branch 'master' into patch-1 2022-05-07 10:36:02 +10:00
stffabi 5f612301f9 [v2] During wails dev only use reload logic if no AssetsHandler are in use (#1385)
This slows down every GET request to the AssetsHandler taking 5s
2022-05-07 09:11:07 +10:00
Lea Anthony 84b6273baf Bugfix/incorrect bindings (#1383)
* Print struct path

* Better handling of anon structs
2022-05-05 23:07:33 +10:00
Lea Anthony 1947a9a17a Hugely improved + darkmode bitmap support. Dynamic scaling factor support 2022-05-05 21:15:50 +10:00
Lea Anthony 9c8a3a62da Update sponsors 2022-05-05 20:53:35 +10:00
Lea Anthony 6224d3aa82 Re-add plain template, Improve stalebot. 2022-05-05 06:53:39 +10:00
stffabi 2d66d2146a [v2] Improve multi platform builds (#1373)
- Make sure to reset the default Arch of the build options and not keep the previous one.
- Expand to the full platform in outputBinaries so e.g. `-platform windows` can be used with `-nsis`
2022-05-04 07:27:13 +10:00
Arpit Jain e5cc18cfc5 Fix docs formatting 2022-05-03 23:21:23 +05:30
Lea Anthony 13fb5352d8 Support sizing tray menu 2022-05-03 08:31:42 +10:00
Aleksey Polyakov 531d7cfb62 replace OnMultiple with EventsOnMultiple (#1369) 2022-05-02 22:10:33 +10:00
Lea Anthony 58b6e4c335 Support retina images 2022-05-02 20:16:04 +10:00
Lea Anthony ae0933c82a Move TrayMenu from config to runtime
Support better tray menu API
Move object creation to main thread
2022-05-02 18:57:35 +10:00
Lea Anthony c1d4aeb3cd Merge branch 'master' into exp 2022-05-01 20:55:41 +10:00
Lea Anthony 9c7ef2d47c v2.0.0-beta.36 2022-05-01 11:10:05 +10:00
Lea Anthony 490388ae8f Another vue fix 2022-05-01 10:47:09 +10:00
Lea Anthony fac2a8ba3c Closes #1357 #1366 2022-05-01 10:41:07 +10:00
Lea Anthony 912d7cf34b Add startup method to templates by default 2022-05-01 10:19:15 +10:00
Lea Anthony 848ea88207 Update stale.yml 2022-05-01 09:47:43 +10:00
Lea Anthony 1830c64c79 Better Checked implementation 2022-04-30 21:39:19 +10:00
Lea Anthony ee50170374 Support activation policy 2022-04-30 17:51:11 +10:00
Lea Anthony 3f82ceabba Initial Tray support for Mac 2022-04-30 12:00:00 +10:00
stffabi 22d3f93b52 [v2, darwin] Initialize native variables on stack to prevent segfault (#1362) 2022-04-30 06:11:19 +10:00
stffabi d9120181b7 [v2] Validate devServer property to be of the correct form (#1359) 2022-04-29 07:22:45 +10:00
Lea Anthony 0a9ae0dff3 fix docs again 2022-04-27 22:29:25 +10:00
Lea Anthony 3dbe2a0942 Fix docs 2022-04-27 22:13:12 +10:00
393 changed files with 6731 additions and 1745 deletions
+3 -1
View File
@@ -11,7 +11,9 @@ body:
Before submitting this issue, please do the following:
- Do a web search for your error. This usually leads to a much better understanding of the issue.
- Prove that the error is indeed a Wails bug and not an application bug, with a specific set of steps to reproduce.
- Search both the issue tracker (even closed issues) and discussion forums.
- Search the issue tracker using [this link](https://github.com/wailsapp/wails/issues?q=is%3Aissue+).
- Search the [discussion forums](https://github.com/wailsapp/wails/discussions?discussions_q=type+your+issue+here).
- Read the [Troubleshooting Guide](https://wails.io/docs/next/guides/troubleshooting).
- Try to fix it yourself. Keep a list of things you have done to fix the problem.
If after doing all the above, the problem remains, please continue with this ticket providing *all* the information requested.
@@ -7,6 +7,7 @@ body:
- type: markdown
attributes:
value: |
Before opening a feature request, please check the [Roadmap](https://github.com/wailsapp/wails/discussions/1484) to see if it has already been requested.
***Please note: No new feature requests are being accepted for Wails v1***
- type: textarea
+4 -1
View File
@@ -8,6 +8,7 @@ exemptLabels:
- security
- onhold
- inprogress
- "Selected For Development"
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
@@ -16,4 +17,6 @@ markComment: >
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
closeComment: false
exemptMilestones: true
exemptAssignees: true
+1
View File
@@ -32,3 +32,4 @@ v2/test/kitchensink/frontend/package.json.md5
!v2/internal/ffenestri/windows/x64/WebView2Loader.dll
.idea/
v2/cmd/wails/internal/commands/initialise/templates/testtemplates/
v2/internal/frontend/desktop/darwin/test.xcodeproj
+17 -9
View File
@@ -106,8 +106,8 @@ This project is supported by these kind people / companies:
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
<img src="/img/silver%20sponsor.png" width="100"/>
</a>
<a href="https://github.com/letheanVPN" style="width:100px;">
<img src="https://github.com/letheanVPN.png?size=100" width="100"/>
<a href="https://github.com/selvindev" style="width:100px;">
<img src="https://github.com/selvindev.png?size=100" width="100"/>
</a>
<br/>
<br/>
@@ -158,9 +158,6 @@ This project is supported by these kind people / companies:
<a href="https://github.com/bglw" style="width:65px">
<img src="https://github.com/bglw.png?size=65" width="65"/>
</a>
<a href="https://github.com/jugglingjsons" style="width:50px">
<img src="https://github.com/jugglingjsons.png?size=50" width="50"/>
</a>
<a href="https://github.com/marcus-crane" style="width:65px">
<img src="https://github.com/marcus-crane.png?size=65" width="65"/>
</a>
@@ -194,12 +191,23 @@ This project is supported by these kind people / companies:
<a href="https://github.com/GargantuaX" style="width:45px">
<img src="https://github.com/GargantuaX.png?size=45" width="45"/>
</a>
<a href="https://github.com/brodyover" style="width:45px">
<img src="https://github.com/brodyover.png?size=45" width="45"/>
<a href="https://github.com/CharlieGo88" style="width:55px">
<img src="https://github.com/CharlieGo88.png?size=55" width="55"/>
</a>
<a href="https://github.com/Bironou" style="width:55px">
<img src="https://github.com/Bironou.png?size=55" width="55"/>
</a>
<a href="https://github.com/Shackelford-Arden" style="width:55px">
<img src="https://github.com/Shackelford-Arden.png?size=55" width="55"/>
</a>
<span id="nav-6"></span>
## Roadmap
The project roadmap may be found [here](https://github.com/wailsapp/wails/discussions/1484). Please consult
this before open up an enhancement request.
## Installation
The installation instructions are on the [official website](https://wails.io/docs/gettingstarted/installation).
@@ -211,8 +219,8 @@ The installation instructions are on the [official website](https://wails.io/doc
- Is this an alternative to Electron?
Depends on your requirements. It's designed to make it easy for Go programmers to make lightweight desktop
applications or add a frontend to their existing applications. Whilst Wails does not currently offer hooks into native
elements such as menus, this may change in the future.
applications or add a frontend to their existing applications. Wails v2 does offer native elements such as menus
and dialogs, so it is becoming a lightweight electron alternative.
- Who is this project aimed at?
+10 -7
View File
@@ -116,8 +116,8 @@ Wails v2 已针对所有 3 个平台发布了 Beta 版。如果您有兴趣尝
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
<img src="/img/silver%20sponsor.png" width="100"/>
</a>
<a href="https://github.com/letheanVPN" style="width:100px;">
<img src="https://github.com/letheanVPN.png?size=100" width="100"/>
<a href="https://github.com/selvindev" style="width:100px;">
<img src="https://github.com/selvindev.png?size=100" width="100"/>
</a>
<br/>
<br/>
@@ -168,9 +168,6 @@ Wails v2 已针对所有 3 个平台发布了 Beta 版。如果您有兴趣尝
<a href="https://github.com/bglw" style="width:65px">
<img src="https://github.com/bglw.png?size=65" width="65"/>
</a>
<a href="https://github.com/jugglingjsons" style="width:50px">
<img src="https://github.com/jugglingjsons.png?size=50" width="50"/>
</a>
<a href="https://github.com/marcus-crane" style="width:65px">
<img src="https://github.com/marcus-crane.png?size=65" width="65"/>
</a>
@@ -204,8 +201,14 @@ Wails v2 已针对所有 3 个平台发布了 Beta 版。如果您有兴趣尝
<a href="https://github.com/GargantuaX" style="width:45px">
<img src="https://github.com/GargantuaX.png?size=45" width="45"/>
</a>
<a href="https://github.com/brodyover" style="width:45px">
<img src="https://github.com/brodyover.png?size=45" width="45"/>
<a href="https://github.com/CharlieGo88" style="width:55px">
<img src="https://github.com/CharlieGo88.png?size=55" width="55"/>
</a>
<a href="https://github.com/Bironou" style="width:55px">
<img src="https://github.com/Bironou.png?size=55" width="55"/>
</a>
<a href="https://github.com/Shackelford-Arden" style="width:55px">
<img src="https://github.com/Shackelford-Arden.png?size=55" width="55"/>
</a>
<span id="nav-6"></span>
+12 -3
View File
@@ -99,6 +99,12 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
trimpath := false
command.BoolFlag("trimpath", "Remove all file system paths from the resulting executable", &trimpath)
raceDetector := false
command.BoolFlag("race", "Build with Go's race detector", &raceDetector)
windowsConsole := false
command.BoolFlag("windowsconsole", "Keep the console when building for Windows", &windowsConsole)
command.Action(func() error {
quiet := verbosity == 0
@@ -180,6 +186,8 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
UserTags: userTags,
WebView2Strategy: wv2rtstrategy,
TrimPath: trimpath,
RaceDetector: raceDetector,
WindowsConsole: windowsConsole,
}
// Start a new tabwriter
@@ -197,6 +205,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
_, _ = fmt.Fprintf(w, "Clean Build Dir: \t%t\n", buildOptions.CleanBuildDirectory)
_, _ = fmt.Fprintf(w, "LDFlags: \t\"%s\"\n", buildOptions.LDFlags)
_, _ = fmt.Fprintf(w, "Tags: \t[%s]\n", strings.Join(buildOptions.UserTags, ","))
_, _ = fmt.Fprintf(w, "Race Detector: \t%t\n", buildOptions.RaceDetector)
if len(buildOptions.OutputFile) > 0 && targets.Length() == 1 {
_, _ = fmt.Fprintf(w, "Output File: \t%s\n", buildOptions.OutputFile)
}
@@ -229,6 +238,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
"linux",
"linux/amd64",
"linux/arm64",
"linux/arm",
"windows",
"windows/amd64",
"windows/arm64",
@@ -259,10 +269,9 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
// Calculate platform and arch
platformSplit := strings.Split(platform, "/")
buildOptions.Platform = platformSplit[0]
buildOptions.Arch = runtime.GOARCH
if system.IsAppleSilicon {
buildOptions.Arch = "arm64"
} else {
buildOptions.Arch = runtime.GOARCH
}
if len(platformSplit) == 2 {
buildOptions.Arch = platformSplit[1]
@@ -330,7 +339,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
// Output stats
buildOptions.Logger.Println(fmt.Sprintf("Built '%s' in %s.\n", outputFilename, time.Since(start).Round(time.Millisecond).String()))
outputBinaries[platform] = outputFilename
outputBinaries[buildOptions.Platform+"/"+buildOptions.Arch] = outputFilename
})
if targetErr != nil {
+101 -59
View File
@@ -2,8 +2,10 @@ package dev
import (
"context"
"errors"
"fmt"
"io"
"net"
"net/http"
"net/url"
"os"
@@ -35,16 +37,25 @@ import (
)
func LogGreen(message string, args ...interface{}) {
if len(message) == 0 {
return
}
text := fmt.Sprintf(message, args...)
println(colour.Green(text))
}
func LogRed(message string, args ...interface{}) {
if len(message) == 0 {
return
}
text := fmt.Sprintf(message, args...)
println(colour.Red(text))
}
func LogDarkYellow(message string, args ...interface{}) {
if len(message) == 0 {
return
}
text := fmt.Sprintf(message, args...)
println(colour.DarkYellow(text))
}
@@ -65,6 +76,7 @@ type devFlags struct {
reloadDirs string
openBrowser bool
noReload bool
noGen bool
wailsjsdir string
tags string
verbosity int
@@ -74,6 +86,7 @@ type devFlags struct {
devServer string
appargs string
saveConfig bool
raceDetector bool
frontendDevServerURL string
}
@@ -91,6 +104,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
command.StringFlag("reloaddirs", "Additional directories to trigger reloads (comma separated)", &flags.reloadDirs)
command.BoolFlag("browser", "Open application in browser", &flags.openBrowser)
command.BoolFlag("noreload", "Disable reload on asset change", &flags.noReload)
command.BoolFlag("nogen", "Disable generate module", &flags.noGen)
command.StringFlag("wailsjsdir", "Directory to generate the Wails JS modules", &flags.wailsjsdir)
command.StringFlag("tags", "tags to pass to Go compiler (quoted and space separated)", &flags.tags)
command.IntFlag("v", "Verbosity level (0 - silent, 1 - standard, 2 - verbose)", &flags.verbosity)
@@ -99,8 +113,9 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
command.IntFlag("debounce", "The amount of time to wait to trigger a reload on change", &flags.debounceMS)
command.StringFlag("devserver", "The address of the wails dev server", &flags.devServer)
command.StringFlag("frontenddevserverurl", "The url of the external frontend dev server to use", &flags.frontendDevServerURL)
command.StringFlag("appargs", "arguments to pass to the underlying app (quoted and space searated)", &flags.appargs)
command.StringFlag("appargs", "arguments to pass to the underlying app (quoted and space separated)", &flags.appargs)
command.BoolFlag("save", "Save given flags as defaults", &flags.saveConfig)
command.BoolFlag("race", "Build with Go's race detector", &flags.raceDetector)
command.Action(func() error {
// Create logger
@@ -125,6 +140,16 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
return err
}
devServer := flags.devServer
if _, _, err := net.SplitHostPort(devServer); err != nil {
return fmt.Errorf("DevServer is not of the form 'host:port', please check your wails.json")
}
devServerURL, err := url.Parse("http://" + devServer)
if err != nil {
return err
}
// Update go.mod to use current wails version
err = syncGoModVersion(cwd)
if err != nil {
@@ -137,22 +162,22 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
return err
}
self := os.Args[0]
if flags.tags != "" {
err = runCommand(cwd, true, self, "generate", "module", "-tags", flags.tags)
} else {
err = runCommand(cwd, true, self, "generate", "module")
}
if err != nil {
return err
if !flags.noGen {
self := os.Args[0]
if flags.tags != "" {
err = runCommand(cwd, true, self, "generate", "module", "-tags", flags.tags)
} else {
err = runCommand(cwd, true, self, "generate", "module")
}
if err != nil {
return err
}
}
buildOptions := generateBuildOptions(flags)
buildOptions.Logger = logger
buildOptions.UserTags = internal.ParseUserTags(flags.tags)
var debugBinaryProcess *process.Process = nil
// Setup signal handler
quitChannel := make(chan os.Signal, 1)
signal.Notify(quitChannel, os.Interrupt, os.Kill, syscall.SIGTERM)
@@ -160,24 +185,23 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
// Do initial build
logger.Println("Building application for development...")
newProcess, appBinary, err := restartApp(buildOptions, debugBinaryProcess, flags, exitCodeChannel)
debugBinaryProcess, appBinary, err := restartApp(buildOptions, nil, flags, exitCodeChannel)
if err != nil {
return err
}
if newProcess != nil {
debugBinaryProcess = newProcess
}
defer func() {
if err := killProcessAndCleanupBinary(debugBinaryProcess, appBinary); err != nil {
LogDarkYellow("Unable to kill process and cleanup binary: %s", err)
}
}()
// frontend:dev:watcher command.
if command := projectConfig.DevWatcherCommand; command != "" {
var devCommandWaitGroup sync.WaitGroup
closer := runFrontendDevWatcherCommand(cwd, command, &devCommandWaitGroup)
defer closer(&devCommandWaitGroup)
}
devServerURL, err := url.Parse("http://" + flags.devServer)
if err != nil {
return err
closer, err := runFrontendDevWatcherCommand(cwd, command)
if err != nil {
return err
}
defer closer()
}
// open browser
@@ -209,22 +233,17 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
LogGreen("Using reload debounce setting of %d milliseconds", flags.debounceMS)
// Watch for changes and trigger restartApp()
doWatcherLoop(buildOptions, debugBinaryProcess, flags, watcher, exitCodeChannel, quitChannel, devServerURL)
debugBinaryProcess = doWatcherLoop(buildOptions, debugBinaryProcess, flags, watcher, exitCodeChannel, quitChannel, devServerURL)
// Kill the current program if running
if debugBinaryProcess != nil {
err := debugBinaryProcess.Kill()
if err != nil {
return err
}
}
// Remove dev binary
err = os.Remove(appBinary)
if err != nil {
// Kill the current program if running and remove dev binary
if err := killProcessAndCleanupBinary(debugBinaryProcess, appBinary); err != nil {
return err
}
// Reset the process and the binary so the defer knows about it and is a nop.
debugBinaryProcess = nil
appBinary = ""
LogGreen("Development mode exited")
return nil
@@ -232,6 +251,22 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
return nil
}
func killProcessAndCleanupBinary(process *process.Process, binary string) error {
if process != nil && process.Running {
if err := process.Kill(); err != nil {
return err
}
}
if binary != "" {
err := os.Remove(binary)
if err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
}
return nil
}
func syncGoModVersion(cwd string) error {
gomodFilename := filepath.Join(cwd, "go.mod")
gomodData, err := os.ReadFile(gomodFilename)
@@ -293,6 +328,7 @@ func generateBuildOptions(flags devFlags) *build.Options {
IgnoreFrontend: false,
Verbosity: flags.verbosity,
WailsJSDir: flags.wailsjsdir,
RaceDetector: flags.raceDetector,
}
return result
@@ -375,35 +411,39 @@ func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, e
}
// runFrontendDevWatcherCommand will run the `frontend:dev:watcher` command if it was given, ex- `npm run dev`
func runFrontendDevWatcherCommand(cwd string, devCommand string, wg *sync.WaitGroup) func(group *sync.WaitGroup) {
LogGreen("Running frontend dev watcher command: '%s'", devCommand)
func runFrontendDevWatcherCommand(cwd string, devCommand string) (func(), error) {
ctx, cancel := context.WithCancel(context.Background())
dir := filepath.Join(cwd, "frontend")
cmdSlice := strings.Split(devCommand, " ")
wg.Add(1)
cmd := exec.CommandContext(ctx, cmdSlice[0], cmdSlice[1:]...)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.Dir = dir
setParentGID(cmd)
go func(ctx context.Context, devCommand string, cwd string, wg *sync.WaitGroup) {
err := cmd.Run()
if err != nil {
if err := cmd.Start(); err != nil {
cancel()
return nil, fmt.Errorf("Unable to start frontend DevWatcher: %w", err)
}
LogGreen("Running frontend DevWatcher command: '%s'", devCommand)
var wg sync.WaitGroup
wg.Add(1)
go func() {
if err := cmd.Wait(); err != nil {
if err.Error() != "exit status 1" {
LogRed("Error from '%s': %s", devCommand, err.Error())
LogRed("Error from DevWatcher '%s': %s", devCommand, err.Error())
}
}
LogGreen("Dev command exited!")
LogGreen("DevWatcher command exited!")
wg.Done()
}(ctx, devCommand, cwd, wg)
}()
return func(wg *sync.WaitGroup) {
return func() {
killProc(cmd, devCommand)
LogGreen("Dev command killed!")
LogGreen("DevWatcher command killed!")
cancel()
wg.Wait()
}
}, nil
}
// initialiseWatcher creates the project directory watcher that will trigger recompile
@@ -450,8 +490,13 @@ func restartApp(buildOptions *build.Options, debugBinaryProcess *process.Process
appBinary, err := build.Build(buildOptions)
println()
if err != nil {
LogRed("Build error - continuing to run current version")
LogDarkYellow(err.Error())
LogRed("Build error - " + err.Error())
msg := "Continuing to run current version"
if debugBinaryProcess == nil {
msg = "No version running, build will be retriggered as soon as changes have been detected"
}
LogDarkYellow(msg)
return nil, "", nil
}
@@ -497,12 +542,8 @@ func restartApp(buildOptions *build.Options, debugBinaryProcess *process.Process
}
// doWatcherLoop is the main watch loop that runs while dev is active
func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Process, flags devFlags, watcher *fsnotify.Watcher, exitCodeChannel chan int, quitChannel chan os.Signal, devServerURL *url.URL) {
func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Process, flags devFlags, watcher *fsnotify.Watcher, exitCodeChannel chan int, quitChannel chan os.Signal, devServerURL *url.URL) *process.Process {
// Main Loop
var (
err error
newBinaryProcess *process.Process
)
var extensionsThatTriggerARebuild = sliceToMap(strings.Split(flags.extensions, ","))
var dirsThatTriggerAReload []string
for _, dir := range strings.Split(flags.reloadDirs, ",") {
@@ -528,7 +569,7 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
assetDirURL := joinPath(devServerURL, "/wails/assetdir")
reloadURL := joinPath(devServerURL, "/wails/reload")
for quit == false {
//reload := false
// reload := false
select {
case exitCode := <-exitCodeChannel:
if exitCode == 0 {
@@ -573,7 +614,7 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
if item.Op&fsnotify.Create == fsnotify.Create {
// If this is a folder, add it to our watch list
if fs.DirExists(item.Name) {
//node_modules is BANNED!
// node_modules is BANNED!
if !strings.Contains(item.Name, "node_modules") {
err := watcher.Add(item.Name)
if err != nil {
@@ -588,7 +629,7 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
rebuild = false
LogGreen("[Rebuild triggered] files updated")
// Try and build the app
newBinaryProcess, _, err = restartApp(buildOptions, debugBinaryProcess, flags, exitCodeChannel)
newBinaryProcess, _, err := restartApp(buildOptions, debugBinaryProcess, flags, exitCodeChannel)
if err != nil {
LogRed("Error during build: %s", err.Error())
continue
@@ -634,7 +675,7 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
}
if reload {
reload = false
_, err = http.Get(reloadURL)
_, err := http.Get(reloadURL)
if err != nil {
LogRed("Error during refresh: %s", err.Error())
}
@@ -644,6 +685,7 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
quit = true
}
}
return debugBinaryProcess
}
func joinPath(url *url.URL, subPath string) string {
@@ -6,6 +6,8 @@ package dev
import (
"os/exec"
"syscall"
"golang.org/x/sys/unix"
)
func setParentGID(cmd *exec.Cmd) {
@@ -15,6 +17,10 @@ func setParentGID(cmd *exec.Cmd) {
}
func killProc(cmd *exec.Cmd, devCommand string) {
if cmd == nil || cmd.Process == nil {
return
}
// Experiencing the same issue on macOS BigSur
// I'm using Vite, but I would imagine this could be an issue with Node (npm) in general
// Also, after several edit/rebuild cycles any abnormal shutdown (crash or CTRL-C) may still leave Node running
@@ -22,7 +28,7 @@ func killProc(cmd *exec.Cmd, devCommand string) {
// Not tested on *nix
pgid, err := syscall.Getpgid(cmd.Process.Pid)
if err == nil {
err := syscall.Kill(-pgid, 15) // note the minus sign
err := syscall.Kill(-pgid, unix.SIGTERM) // note the minus sign
if err != nil {
LogRed("Error from '%s' when attempting to kill the process: %s", devCommand, err.Error())
}
@@ -50,10 +50,8 @@ func AddModuleCommand(app *clir.Cli, parent *clir.Command, w io.Writer) error {
return fmt.Errorf("%s\n%s\n%s", stdout, stderr, err)
}
err = os.Remove(filename)
if err != nil {
return err
}
// Best effort removal of temp file
_ = os.Remove(filename)
return nil
})
@@ -53,8 +53,6 @@ github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oO
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
github.com/leaanthony/go-ansi-parser v1.0.1 h1:97v6c5kYppVsbScf4r/VZdXyQ21KQIfeQOk2DgKxGG4=
github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM=
github.com/leaanthony/go-common-file-dialog v1.0.3 h1:O0uGjKnWtdEADGrkg+TyAAbZylykMwwx/MNEXn9fp+Y=
github.com/leaanthony/go-common-file-dialog v1.0.3/go.mod h1:TGhEc9eSJgRsupZ+iH1ZgAOnEo9zp05cRH2j08RPrF0=
github.com/leaanthony/gosod v1.0.3 h1:Fnt+/B6NjQOVuCWOKYRREZnjGyvg+mEhd1nkkA04aTQ=
github.com/leaanthony/gosod v1.0.3/go.mod h1:BJ2J+oHsQIyIQpnLPjnqFGTMnOZXDbvWtRCSG7jGxs4=
github.com/leaanthony/idgen v1.0.0/go.mod h1:4nBZnt8ml/f/ic/EVQuLxuj817RccT2fyrUaZFxrcVA=
@@ -12,7 +12,6 @@ module changeme
github.com/labstack/echo/v4 v4.7.2 // indirect
github.com/labstack/gommon v0.3.1 // indirect
github.com/leaanthony/go-ansi-parser v1.0.1 // indirect
github.com/leaanthony/go-common-file-dialog v1.0.3 // indirect
github.com/leaanthony/gosod v1.0.3 // indirect
github.com/leaanthony/slicer v1.5.0 // indirect
github.com/leaanthony/typescriptify-golang-structs v0.1.7 // indirect
@@ -35,7 +35,7 @@ func main() {
Frameless: false,
StartHidden: false,
HideWindowOnClose: false,
RGBA: &options.RGBA{R: 255, G: 255, B: 255, A: 255},
BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 255},
Assets: assets,
Menu: nil,
Logger: nil,
@@ -216,6 +216,16 @@ func initGit(options *templates.Options) error {
return errors.Wrap(err, "Unable to initialise git repository:")
}
ignore := []string{
"build/bin",
"frontend/dist",
"frontend/node_modules",
}
err = os.WriteFile(filepath.Join(options.TargetDir, ".gitignore"), []byte(strings.Join(ignore, "\n")), 0644)
if err != nil {
return errors.Wrap(err, "Unable to create gitignore")
}
return nil
}
@@ -15,6 +15,12 @@ func NewApp() *App {
return &App{}
}
// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
a.ctx = ctx
}
// Greet returns a greeting for the given name
func (a *App) Greet(name string) string {
return fmt.Sprintf("Hello %s, It's show time!", name)
@@ -2,6 +2,7 @@ package main
import (
"embed"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
)
@@ -15,10 +16,12 @@ func main() {
// Create application with options
err := wails.Run(&options.App{
Title: "{{.ProjectName}}",
Width: 1024,
Height: 768,
Assets: assets,
Title: "{{.ProjectName}}",
Width: 1024,
Height: 768,
Assets: assets,
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
OnStartup: app.startup,
Bind: []interface{}{
app,
},
@@ -167,9 +167,9 @@ export function WindowMinimise(): void;
// Restores the window to the dimensions and position prior to minimising.
export function WindowUnminimise(): void;
// [WindowSetRGBA](https://wails.io/docs/reference/runtime/window#windowsetrgba)
// [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
// Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
export function WindowSetRGBA(R: number, G: number, B: number, A: number): void;
export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
// [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl)
// Opens the given URL in the system browser.
@@ -177,7 +177,7 @@ export function BrowserOpenURL(url: string): void;
// [Environment](https://wails.io/docs/reference/runtime/intro#environment)
// Returns information about the environment
export function Environment(): EnvironmentInfo;
export function Environment(): Promise<EnvironmentInfo>;
// [Quit](https://wails.io/docs/reference/runtime/intro#quit)
// Quits the application.
@@ -41,7 +41,7 @@ export function EventsOnMultiple(eventName, callback, maxCallbacks) {
}
export function EventsOn(eventName, callback) {
OnMultiple(eventName, callback, -1);
EventsOnMultiple(eventName, callback, -1);
}
export function EventsOff(eventName) {
@@ -49,7 +49,7 @@ export function EventsOff(eventName) {
}
export function EventsOnce(eventName, callback) {
OnMultiple(eventName, callback, 1);
EventsOnMultiple(eventName, callback, 1);
}
export function EventsEmit(eventName) {
@@ -145,8 +145,8 @@ export function WindowUnminimise() {
window.runtime.WindowUnminimise();
}
export function WindowSetRGBA(RGBA) {
window.runtime.WindowSetRGBA(RGBA);
export function WindowSetBackgroundColour(R, G, B, A) {
window.runtime.WindowSetBackgroundColour(R, G, B, A);
}
export function BrowserOpenURL(url) {
@@ -68,32 +68,31 @@ export class MyElement extends LitElement {
}
`
}
@property()
resultText = "Please enter your name below 👇"
@property()
resultText = "Please enter your name below 👇"
greet()
{
let thisName = this.shadowRoot.getElementById('name').value
Greet(thisName).then(result => {
this.resultText = result
});
}
greet() {
let thisName = (this.shadowRoot.getElementById('name') as HTMLInputElement)?.value;
if (thisName) {
Greet(thisName).then(result => {
this.resultText = result
});
}
}
render()
{
return html`
<main>
<img id="logo" src=${logo} alt="Wails logo">
<div class="result" id="result">${this.resultText}</div>
<div class="input-box" id="input">
<input class="input" id="name" type="text" autocomplete="off"/>
<button @click=${this.greet} class="btn">Greet</button>
</div>
</main>
`
}
render() {
return html`
<main>
<img id="logo" src=${logo} alt="Wails logo">
<div class="result" id="result">${this.resultText}</div>
<div class="input-box" id="input">
<input class="input" id="name" type="text" autocomplete="off"/>
<button @click=${this.greet} class="btn">Greet</button>
</div>
</main>
`
}
}
declare global {
@@ -19,7 +19,7 @@ export function App(props: any) {
<img src={logo} id="logo" alt="logo"/>
<div id="result" className="result">{resultText}</div>
<div id="input" className="input-box">
<input id="name" onChange={updateName} autoComplete="off" name="input" type="text"/>
<input id="name" className="input" onChange={updateName} autoComplete="off" name="input" type="text"/>
<button className="btn" onClick={greet}>Greet</button>
</div>
</div>

Some files were not shown because too many files have changed in this diff Show More