mirror of
https://github.com/taigrr/wails.git
synced 2026-04-14 10:50:53 -07:00
[v2] New -debounce flag to configure debounce time of dev server
This commit is contained in:
@@ -161,11 +161,20 @@ The second, if given, will be executed in the `frontend` directory to build the
|
||||
|
||||
If these 2 keys aren't given, then Wails does absolutely nothing with the frontend. It is only expecting that `embed.FS`.
|
||||
|
||||
## Live Reloading
|
||||
## Built in Dev Server
|
||||
|
||||
Running `wails dev` will start a file watcher in your project directory. By default, if any file changes, wails checks
|
||||
if it was an application file (default: `.go`, configurable with `-e` flag). If it was, then it will rebuild your
|
||||
application and relaunch it. If the changed file was in the `assetdir` directory, it will issue a reload.
|
||||
Running `wails dev` will start the built in dev server which will start a file watcher in your project directory. By
|
||||
default, if any file changes, wails checks if it was an application file (default: `.go`, configurable with `-e` flag).
|
||||
If it was, then it will rebuild your application and relaunch it. If the changed file was in the `assetdir` directory,
|
||||
it will issue a reload after a short amount of time.
|
||||
|
||||
The dev server uses a technique called "debouncing" which means it doesn't reload straight away,
|
||||
as there may be multiple files changed in a short amount of time. When a trigger occurs, it waits for a set amount of time
|
||||
before issuing a reload. If another trigger happens, it resets to the wait time again. By default this value is `100ms`.
|
||||
If this value doesn't work for your project, it can be configured using the `-debounce` flag. If used, this value will
|
||||
be saved to your project config and become the default.
|
||||
|
||||
## External Dev Server
|
||||
|
||||
Some frameworks come with their own live-reloading server, however they will not be able to take advantage of the Wails
|
||||
Go bindings. In this scenario, it is best to run a watcher script that rebuilds the project into the build directory, which
|
||||
|
||||
@@ -131,7 +131,8 @@ Your system is ready for Wails development!
|
||||
| -loglevel "loglevel"| Loglevel to use - Trace, Debug, Info, Warning, Error | Debug |
|
||||
| -noreload | Disable automatic reload when assets change | |
|
||||
| -v | Verbosity level (0 - silent, 1 - standard, 2 - verbose) | 1 |
|
||||
| -wailsjsdir | The directory to generate the generated Wails JS modules | Value store in `wails.json` |
|
||||
| -wailsjsdir | The directory to generate the generated Wails JS modules | Value in `wails.json` |
|
||||
| -debounce | The time to wait for reload after an asset change is detected | 100 (milliseconds) |
|
||||
|
||||
If the `-assetdir` or `-wailsjsdir` flags are provided on the command line, they are saved in `wails.json`, and become
|
||||
the defaults for subsequent invocations.
|
||||
|
||||
@@ -14,7 +14,8 @@ The project config resides in the `wails.json` file in the project directory. Th
|
||||
"frontend:build": "[The command to build the assets, run in the frontend directory - often `npm run build`]",
|
||||
"wailsjsdir": "[Relative path to the directory that the auto-generated JS modules will be created]",
|
||||
"version": "[Project config version]",
|
||||
"outputfilename": "[The name of the binary]"
|
||||
"outputfilename": "[The name of the binary]",
|
||||
"debounceMS": 100, // The default time the dev server waits to reload when it detects a vhange in assets
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user