Stdweb has examples for how to call Rust-functions from Javascript in paragraph titled Exposing Rust functions to JavaScript
, but how do you expose your custom Javascript functions to Rust?
Mozilla WebAssembly documentation defines that Javascript functions can be imported into wasm using importObject definition, but stdweb generates the glue javascript file, where the importObject contains the stdweb supported WEB API functions (as well as Rust exported functions).
So one possible solution I can see for this is, that you can export a Rust-function which takes a Javascript function as a function parameter. The function parameter value is stored into some Rust internal storage and is called when the javascript functionality is required.
Is it possible to do that kind of handling or is there a better way?