emscripten-core / emscripten-core/emscripten
HTML5 Callbacks and C++
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
I am trying to make a simple c++ class that wraps an HTML element. When the user clicks on the element, the onclick event would call a member function of the class. Perhaps I missed the obvious, but there doesn't seem to be any direct way to do that. I was able to use:
`emscripten_set_click_callback( "#button", this, 1, Button::on_button_click );`
However that required adding a static member function (on_button_click), which would then call the member function. I noticed that the callback has eventType as the first argument and was thinking that if userData was first instead, that would be ideal for member functions (provided userData = this).
Contributor guide
Assessment
This issue has not been assessed yet.