File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -17,15 +17,27 @@ struct BindingType<nl::json> {
1717 using ValBinding = BindingType<val>;
1818 using WireType = typename ValBinding::WireType;
1919
20+ #if __EMSCRIPTEN_major__ == 3 && __EMSCRIPTEN_major__ == 1 && __EMSCRIPTEN_tiny__ <= 45
2021 static WireType toWireType (const nl::json& obj) {
2122 // as string
2223 const auto str = obj.dump ();
2324 const auto jstr = val (str.c_str ());
2425 const auto js_obj = val::global (" JSON" ).call <val>(" parse" , jstr);
2526 return ValBinding::toWireType (js_obj);
2627 }
28+ #else
29+ template <typename ReturnPolicy = void >
30+ static WireType toWireType (const nl::json& obj, rvp::default_tag) {
31+ // as string
32+ const auto str = obj.dump ();
33+ const auto jstr = val (str.c_str ());
34+ const auto js_obj = val::global (" JSON" ).call <val>(" parse" , jstr);
35+ return ValBinding::toWireType (js_obj, rvp::default_tag{});
36+ }
37+ #endif
2738
28- static nl::json fromWireType (WireType value) {
39+ template <typename ReturnPolicy = void >
40+ static nl::json fromWireType (WireType value ) {
2941 // first as emscripten::val
3042 const auto js_obj = ValBinding::fromWireType (value);
3143 // then as string
You can’t perform that action at this time.
0 commit comments