Skip to content

Commit 6ec370b

Browse files
committed
Add configurable event scheduling
1 parent 35b7bce commit 6ec370b

4 files changed

Lines changed: 408 additions & 48 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ The current phase provides:
2929
`Window.run`;
3030
- connected, disconnected, click, and intercepted navigation events through
3131
`Window.onEvent`;
32+
- per-window serial or concurrent binding and event execution through
33+
`Window.setEventMode()`;
34+
- bounded concurrent handlers through `WindowOptions.max_pending_events`;
3235
- same-origin WebSocket validation for hosted content and external-page Origin
3336
validation for `.external_url`;
3437
- optional path-scoped `HttpOnly` cookie authorization through
@@ -104,6 +107,12 @@ URL for navigation, and is empty for connected or disconnected events.
104107
Navigation attempts are intercepted while an event handler is installed; call
105108
`Event.client.navigate` from the handler to continue them.
106109

110+
Handlers run in `.serial` mode by default. `Window.setEventMode(.concurrent)`
111+
changes newly received binding calls and browser events to independent tasks.
112+
Concurrent tasks own their event data, are bounded by
113+
`WindowOptions.max_pending_events`, and are canceled and joined by
114+
`Running.stop()`.
115+
107116
`Window.bind("button", ...)` also dispatches clicks from elements with
108117
`id="button"`, including elements added after the bridge loads. DOM click
109118
handlers receive no arguments and their replies are ignored; explicit

docs/PURE_ZIG_REFACTOR.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ implementations.
299299
| `webui_show_client()` | `Client` cannot replace the content of only one connected browser. |
300300
| `webui_is_shown()` | There is no window-level connected/shown query. |
301301
| `webui_set_config(show_wait_connection)`, `webui_set_timeout()` | `Window.open()` does not optionally wait for a browser connection. |
302-
| `webui_set_config(ui_event_blocking)`, `webui_set_event_blocking()` | Per-window event scheduling control is not exposed. |
303302
| `webui_set_config(folder_monitor)` | Directory change monitoring and automatic browser reload are not implemented. |
304303
| `webui_set_default_root_folder()` | There is no application-wide default directory content setting. |
305304
| `webui_set_logger()` | There is no caller-provided logging callback. |
@@ -343,6 +342,7 @@ not implementation gaps:
343342
| `webui_get_string()`, `webui_get_string_at()`, `webui_get_int()`, `webui_get_int_at()`, `webui_get_float()`, `webui_get_float_at()`, `webui_get_bool()`, `webui_get_bool_at()` | `Call.string()`, `Call.int()`, `Call.float()`, and `Call.boolean()`. |
344343
| `webui_return_string()`, `webui_return_int()`, `webui_return_float()`, `webui_return_bool()` | `Call.reply()`, `Call.replyInt()`, `Call.replyFloat()`, and `Call.replyBool()`. |
345344
| `webui_set_config(asynchronous_response)` | `Call.deferReply()` transfers the response to a bounded, owned, one-shot `PendingReply`. |
345+
| `webui_set_config(ui_event_blocking)`, `webui_set_event_blocking()` | `WindowOptions.event_mode` and `Window.setEventMode()` select serial or bounded concurrent binding and event execution. |
346346
| `webui_run()`, `webui_script()` | `Window.run()` and `Window.eval()`. |
347347
| `webui_run_client()`, `webui_script_client()` | `Client.run()` and `Client.eval()`. |
348348
| `webui_close_client()`, `webui_navigate_client()`, `webui_send_raw_client()` | `Client.close()`, `Client.navigate()`, and `Client.sendRaw()`. |
@@ -385,14 +385,11 @@ methods, and the public browser bridge surface.
385385

386386
### Handler and event lifecycle
387387

388-
- Add per-window serialized or concurrent event execution.
389388
- Add optional wait-for-connection behavior and a connection timeout.
390389
- Add a caller-provided logger.
391-
- Expose only stable event metadata that has no C ABI dependency.
392390

393-
This completes the remaining `webui_set_config()` behavior,
394-
`webui_set_event_blocking()`, `webui_set_timeout()`, and
395-
`webui_set_logger()`.
391+
This completes `webui_set_config(show_wait_connection)`,
392+
`webui_set_timeout()`, and `webui_set_logger()`.
396393

397394
### Dynamic content and client state
398395

@@ -493,6 +490,5 @@ zig build -Dtarget=aarch64-macos
493490

494491
Continue capability parity:
495492

496-
1. Add per-window event scheduling control.
497-
2. Add optional wait-for-connection behavior and a connection timeout.
498-
3. Add a caller-provided logger.
493+
1. Add optional wait-for-connection behavior and a connection timeout.
494+
2. Add a caller-provided logger.

0 commit comments

Comments
 (0)