maxence-charriere / go-app

A package to build progressive web apps with Go programming language and WebAssembly.
https://go-app.dev
MIT License
7.75k stars 354 forks source link

event handler options integration #942

Closed maxence-charriere closed 2 months ago

maxence-charriere commented 2 months ago

This PR adds support for event handlers options in order define scope or passive options. @oderwat can you take a look on this and tell whether it would solve your issue?

Usage:

// Event with scope
app.Div().OnScroll(func(cox app.Context, e app.Event){}, app.EventScope("1"))

// Passive event
app.Div().OnScroll(func(cox app.Context, e app.Event){}, app.PassiveEvent())

// Multiple options
app.Div().OnScroll(func(cox app.Context, e app.Event){},
    app.PassiveEvent(),
    app.EventScope("1"),
)