Skip to content

Commit 126815e

Browse files
committed
Add directory change monitoring
1 parent 0257cb2 commit 126815e

3 files changed

Lines changed: 374 additions & 6 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The current phase provides:
1212
- embedded HTML, static directories, custom resources, external URLs, and a
1313
built-in JavaScript bridge;
1414
- application-wide default static directories for windows without content;
15+
- optional recursive directory monitoring with per-window browser reloads;
1516
- inline and file-backed per-window favicons;
1617
- runtime content and resource-handler replacement through
1718
`Window.setContent()`;
@@ -119,6 +120,11 @@ Set `App.Options.default_directory` to let windows created without `.content`
119120
inherit one static directory. Explicit window content takes precedence. A
120121
window without either setting returns `error.MissingContent`.
121122

123+
Set `App.Options.folder_monitor_interval` to a positive `std.Io.Duration` to
124+
recursively poll active directory content. A changed tree sends
125+
`location.reload();` to that window's connected clients. Monitoring is
126+
disabled by default and stops with `Running.stop()`.
127+
122128
Use `Window.setIcon(io, data, mime_type)` for in-memory favicon data or
123129
`Window.setIconFile(io, path)` for SVG, PNG, ICO, JPEG, GIF, WebP, or AVIF
124130
files. Embedded HTML receives a relative favicon link automatically.

docs/PURE_ZIG_REFACTOR.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ implementations.
297297

298298
| Upstream API | Current gap |
299299
|---|---|
300-
| `webui_set_config(folder_monitor)` | Directory change monitoring and automatic browser reload are not implemented. |
301300
| `webui_open_url()` | The internal OS URL opener is not exposed as a general public API. |
302301
| `webui_get_best_browser()`, `webui_browser_exist()`, `webui_show_browser()`, `webui_set_browser_folder()` | Browser discovery, selection, and custom executable locations are not implemented. |
303302
| `webui_set_custom_parameters()` | Custom browser command-line arguments are not implemented. |
@@ -332,6 +331,7 @@ not implementation gaps:
332331
| `webui_show_client()` | `Client.show()` replaces the window content and navigates only the selected client. |
333332
| `webui_is_shown()` | `Window.isShown()` reports whether the window has at least one connected browser client. |
334333
| `webui_set_default_root_folder()` | `App.Options.default_directory` supplies directory content to windows created without explicit content. |
334+
| `webui_set_config(folder_monitor)` | `App.Options.folder_monitor_interval` enables portable recursive directory polling and reloads the affected window's connected clients. |
335335
| `webui_set_icon()`, `webui_set_icon_file()` | `Window.setIcon()` copies inline data and MIME type; `Window.setIconFile()` loads a supported image file as the window favicon. |
336336
| `webui_wait()`, `webui_wait_async()` | `Running.wait()` used directly or through `std.Io` concurrency. |
337337
| `webui_close()`, `webui_destroy()`, `webui_exit()`, `webui_clean()` | `Window.close()`, `Running.stop()`, and `App.deinit()`. |
@@ -409,15 +409,20 @@ the dynamic root and file-handler methods, `webui_set_default_root_folder()`,
409409
This completes the browser selection, browser process, window control,
410410
profile, and proxy methods in the ledger.
411411

412-
### File monitoring and server-side runtimes
412+
### File monitoring (complete)
413+
414+
Portable recursive directory polling reloads only the clients of a changed
415+
directory window and follows runtime content replacements.
416+
417+
This completes `webui_set_config(folder_monitor)`.
418+
419+
### Server-side runtimes
413420

414-
- Monitor directory content and reload connected clients on changes.
415421
- Run served JavaScript and TypeScript through explicitly selected Deno,
416422
Node.js, or Bun executables.
417423
- Keep runtime execution disabled by default and pass commands as argv.
418424

419-
This completes `webui_set_config(folder_monitor)` and
420-
`webui_set_runtime()`.
425+
This completes `webui_set_runtime()`.
421426

422427
### Native WebViews
423428

@@ -482,4 +487,6 @@ zig build -Dtarget=aarch64-macos
482487

483488
Continue capability parity:
484489

485-
1. Add optional directory change monitoring and browser reload.
490+
1. Expose a general OS URL opener and browser discovery queries.
491+
2. Add explicit browser selection, custom executable locations, and custom
492+
browser arguments.

0 commit comments

Comments
 (0)