flst / upstream /emscripten /test /embind /test_optional_val_lib.cpp
arudradey's picture
Upload folder using huggingface_hub
00df61d verified
Raw
History Blame Contribute Delete
303 Bytes
#include <emscripten/val.h>
#include <optional>
#include <string>
// This file deliberately does NOT include <emscripten/bind.h>
class MyType {
public:
void RunCallback(emscripten::val callback);
};
void MyType::RunCallback(emscripten::val cb) {
cb(std::make_optional(std::string{"Hey"}));
}