Skip to content

How to add Event Listener dynamically? #2423

Answered by gbj
dvorakchen asked this question in Q&A
Discussion options

You must be logged in to vote

To just add an event listener on the window, use one of these helpers

If you need something more specific than that, you should drop into using wasm-bindgen's Closure type to wrap Rust code as a JS function, rather than creating a function from a JS string. See their docs here

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dvorakchen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants