Skip to content

Intitial commit of DebugEvents#815

Merged
dmjio merged 5 commits into
masterfrom
debug-events
Mar 17, 2025
Merged

Intitial commit of DebugEvents#815
dmjio merged 5 commits into
masterfrom
debug-events

Conversation

@dmjio
Copy link
Copy Markdown
Owner

@dmjio dmjio commented Mar 17, 2025

  • Checks that all event handlers defined are being listened for by top-level event delegation (local to the Component mount or top-level App mount).

  • Adds a warning if an event that was raised did not find an event handler for dispatch.

  • Fix detected bug (this feature already found a bug in the svg example). Adds "pointermove" to the top-level Events map

  • Introduce 'Events' type (synonym for Map MisoString Bool)

  • Adds DebugEvent and DebugAll

  • Renames some ambiguous variables to be more descriptive.

  • Passes event Map from App{..} into Event construct continuation.

- Adds componentEvents to ComponentState

  • Renames P,E,S to Property, Event, Style.

This detects if an event, that a user is expecting to fire, is not being listened on by the top level event delegator DOM node (typically body).

main :: IO ()
main = run $ startApp app
   { events = pointerEvents
   }
 
 viewModel :: Model -> View Action
 viewModel x =
     div_
         []
         [ button_ [onPointerDown AddOne] [text "+"]
         , text (ms x)
         , button_ [onPointerDown SubtractOne] [text "-"]
         , button [ onClick NoOp ] [ text "oops" ] 
         -- ^ since `"click"` is not in `pointerEvents`, 
         -- an error will be raised in `console.error`
         ]

dmjio added 3 commits March 17, 2025 00:31
- Checks that all event handlers defined are being listened for by
top-level event delegation (local to the Component mount or
top-level App mount).

- Adds a warning if an event that was raised did not find an event
handler for dispatch.

- Fix detected bug (this feature already found a bug in the svg
example). Adds "pointermove" to the top-level Events map

- Introduce 'Events' type (synonym for Map MisoString Bool)

- Adds DebugEvent and DebugAll

- Renames some ambiguous variables to be more descriptive.

- Passes event Map from App{..} into Event construct
continuation.

- Adds `componentEvents` to `ComponentState`

- Renames P,E,S to Property, Event, Style.
- Everything we need is in App, don't need to register top-level.
Comment thread examples/svg/Main.hs
@dmjio dmjio merged commit 0fde177 into master Mar 17, 2025
@dmjio dmjio deleted the debug-events branch March 17, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant