There is an embind example about passing a function pointer from C++ to JS side, and calling it from JS. See here https://github.com/kripken/emscripten/blob/master/tests/embind/embind.test.js#L1001 for the test.
What I'd do is create a small wrapper JS function that you add as the callback to addEventListener, and that JS function then performs the JS->C++ call of the function pointer. 2016-09-14 8:45 GMT+03:00 Paolo Severini <paolo.sever...@gmail.com>: > > No answer to this? :-) > > On Monday, September 5, 2016 at 2:55:19 PM UTC-7, Paolo Severini wrote: >> >> Hello! >> I am using embind to wrap a JS library in C++ and I would like to use >> callbacks on a val object, such as: >> >> audio.call<void>("addEventListener", "canplaythrough", [](){ >> >> // do something >> >> }, true); >> >> >> I found that the same question was already posed two years ago ( >> https://groups.google.com/forum/#!topic/emscripten-discuss/okaAYmwglLU) >> but there was no good solution at that time. >> Has the support for C++ callbacks as arguments been added now? >> >> Many thanks, >> Paolo >> > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to emscripten-discuss+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.