1 #include <assert.h> 2 3 #include <string> 4 5 #include <emscripten.h> 6 #include <emscripten/val.h> 7 8 using namespace emscripten; 9 main()10int main() { 11 EM_ASM({ 12 globalProperty = { 13 foo: function() { return "bar" } 14 }; 15 }); 16 val globalProperty = val::global("globalProperty"); 17 auto result = globalProperty.call<std::string>("foo"); 18 REPORT_RESULT(result == "bar"); 19 } 20 21