Pauan / rust-dominator

Zero-cost ultra-high-performance declarative DOM library using FRP signals for Rust!
MIT License
998 stars 63 forks source link

Use web-sys to add event listener #69

Closed cecton closed 2 years ago

cecton commented 2 years ago

Related to #68

Pauan commented 2 years ago

Note that this will probably increase the file size, because it has to generate an extra JS wrapper for AddEventListenerOptions (which is completely avoided with the inline_js functions). It will also slightly hurt performance, since Reflect::set is pretty slow, and it's sending uninterned strings across the Rust<->JS boundary.

I'm not against this, though I think using gloo-events would be even nicer, since then the code can be shared with other libraries that also use gloo-events. But that has some costs of its own, since it means the events have to be wrapped in ManuallyDrop...