3 ms·
You can just interpolate bits of Javascript inside C++ to access the DOM, like so: #include <emscripten.h> void sayHello() { EM_ASM( let foo =
by tlb 1y ago
You can just interpolate bits of Javascript inside C++ to access the DOM, like so:
#include <emscripten.h>
void sayHello()
{
EM_ASM(
let foo = document.getElementById('foo')
foo.innerHTML = 'hello';
);
}
See https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#calling-javascript-from-c-c https://emscripten.org/docs/porting/connecting_cpp_and_javas...