Add embind example to Bazel docs (#910)

* Add embind example to Bazel docs

* address feedback
This commit is contained in:
Kevin Lubick
2021-10-14 13:49:36 -04:00
committed by GitHub
parent 7f39d100d8
commit 773e4f955d
5 changed files with 66 additions and 17 deletions

View File

@@ -0,0 +1,16 @@
#include <emscripten/bind.h>
using namespace emscripten;
class HelloClass {
public:
static std::string SayHello(const std::string &name) {
return "Yo! " + name;
};
};
EMSCRIPTEN_BINDINGS(Hello) {
emscripten::class_<HelloClass>("HelloClass")
.constructor<>()
.class_function("SayHello", &HelloClass::SayHello);
}