0

I sucessfully generate a wasm module using emscripten. A .js file is generated along a .wasm file. Loading through node.js works like a charm. So far so good.

C++ bindings looks like this:

#include "worker.hpp"
#include <emscripten/bind.h>

using namespace emscripten;

// Binding code
EMSCRIPTEN_BINDINGS(Worker)
{
    class_<Worker>("Worker")
        .constructor<>()
        .function("Start", &Worker::Start)
        .function("GetGreetings", &Worker::GetGreetings);
}

Node.js code:

const fabricWorker = require('./build/fabric_wasm')

fabricWorker['onRuntimeInitialized'] = () => {
    var instance = new fabricWorker.Worker();
    instance.Start();
    console.log(instance.GetGreetings());
}

Now I'm trying to import it into an Angular component, but I can't find a way to do it. How to import a wasm class generated using emscripten into a component?

Victor
  • 486
  • 3
  • 8

0 Answers0