feat: dispatch managed events through capture and bubble subscriptions
Verify Tessera GUI / verify (push) Failing after 7m13s
Verify Tessera GUI / verify (push) Failing after 7m13s
This commit is contained in:
@@ -180,6 +180,12 @@ return. Bound text tracks its source property; clean derived subtrees and unchan
|
||||
|
||||
Source native subclass construction takes native arguments first, followed by all inherited and own declared fields. For example, a TextBlock subclass with one field accepts `CustomText("text", 2, "#242422", fieldValue)`; optional native arguments can be omitted before the required field suffix. Field storage belongs to the current shared Block content: replacement updates aliases and bindings and releases the previous fields through Aster. This is an implementation subset; field annotations are not yet runtime checked.
|
||||
|
||||
Events use `block.on("click", callback)` or `block.on("click", callback, "capture")`, returning a managed Subscription with `disconnect()` and `isConnected()`. A Block owns its connections; tokens refer to connections weakly and do not retain the target or callback. Dropping a token leaves the listener registered. Disconnection releases the callback and is safe to repeat.
|
||||
|
||||
`block.dispatch(Event("custom"))` returns the dispatched Event. `block.click()` creates a click Event and uses the same dispatcher as native activation. An optional Mount selects one occurrence: `block.dispatch(event, mount)` or `block.click(mount)`. Without a Mount only the target is visited. With one, capture walks from Page through ancestors, then target capture, the object's `onEvent(self, event)` method and target listeners, then ancestors/Page in bubble order. The target method runs before non-capture target listeners. Event fields expose `kind`, `target`, `mount`, `currentTarget`, `currentMount` and `phase` (`capture`, `target`, `bubble`, then `none`). Source subclasses can override onEvent.
|
||||
|
||||
Event methods `stopPropagation()`, `stopImmediatePropagation()`, `preventDefault()` and `isDefaultPrevented()` control delivery or report cancellation; there is currently no additional host default action to cancel. stopPropagation permits remaining listeners on the current occurrence, while the immediate variant stops them too. Listener order is snapshotted at dispatch start; disconnection before a listener's turn skips it, new connections wait for the next dispatch. The existing onClick setter remains a single compatibility callback, called after other non-capture listeners on that Block. All handlers share the VM call budget, with an explicit 10000-delivery limit that reports failure instead of truncating propagation. Reentrant dispatch of the same active Event is rejected; a completed Event can be reused. See [events.endor](examples/events.endor).
|
||||
|
||||
Toggle developer tools with Command-Option-I or F12 on macOS, Control-Shift-I or
|
||||
F12 on Windows/Linux. The compact Console, Sources, Network and Settings tabs
|
||||
share a draggable dock edge. The Sources tree/source
|
||||
|
||||
Reference in New Issue
Block a user