Skip to content

How to correctly implement a Closure from once_into_js to be called multiple times? #3780

Closed Answered by daxpedda
ronnybremer asked this question in Q&A
Discussion options

You must be logged in to vote

Are you trying to instantiate Closures from JS?
Because if not you should not use #[wasm_bindgen] on the impl block.

What issue exactly do you have when trying to use Closure::new() without #[wasm_bindgen]? As far as I could see from your code you just have to use the same parameters as you defined in Closures::onClick_c. E.g. Closure::new(|| ...) instead of Closure::new(|_| ...).

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ronnybremer
Comment options

Answer selected by ronnybremer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #3776 on January 14, 2024 08:13.