Hello, I am changing the logic part of my javascript project to c ++ using embind I have a problem and would like to ask for advice.
First, we change most of the computation and business logic of the existing project to c ++ and execute the corresponding logic Invokes a javascript callback asynchronously to change the UI. I found the data roughly and configured it as below, but it does not work as I thought throw the error. logic.cpp class Logic { public: Logic (); ~ Logic (); std :: function <void ()> callback; / ** * / registerCallback (std :: function <void ()> _cb) { callback = _cb; } / ** * / void doSomething () { blah ......... callback (someClass); blah ...... } }; EMSCRIPTEN_BINDINGS (logic_class) { class_ <Logic> ("Logic") .constructor <> () .function ("registerCallback", & Logic :: registerCallback, allow_raw_pointers ()) .function ("doSomething", & Logic :: doSomething, allow_raw_pointers ()) } main.js window.onload = function () { blah ......... var logic = .....; logic.registerClass (callbackFn); logic.doSomething (); } function callbackFn (someClass) { update ui } Is there any place to get the documentation or examples needed to do the above? -- 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.