Closed bracke closed 3 years ago
Hello,
Yes, it is possible while may be not trivial when JS objects and strings need to be passed to Ada.
See https://github.com/godunko/adawebpack/tree/master/examples/call_ada as simple example.
@godunko
Is there an example of how I can pass u8 elem. arrays to Ada and receive them in JS?
To pass it to Ada you can use a function similar to buffer_to_wasm_stream_element_buffer
in source/adawebpack.mjs
. To get it back, you need to return address and size from Ada side and then call new Uint8Array(instance.exports.memory.buffer, a, l);
. We don't have corresponding example right now.
Hi
In Blazor it's possible to call a C# method from javascript: https://code-maze.com/how-to-call-csharp-methods-from-javascript-in-blazor-webassembly/
Is something similar possible in AdaWebpack?
Note: This is not an event handler, but a more generic way of calling Ada code.
Kind regards Bent Bracke