Files
cocos4/native/tests/sebind-tests/common/Classes/demo/Coconut.cpp
T
2022-05-25 11:17:36 +08:00

20 lines
445 B
C++

#include "Coconut.h"
namespace demo {
std::string Coconut::callJSFunction(const std::string &name) {
if (!_jsThis) {
return "jsThis is not set";
}
se::Value prop;
_jsThis->getProperty(name, &prop);
if (prop.isNullOrUndefined()) {
return "function found!";
}
se::Value ret;
prop.toObject()->call({}, _jsThis, &prop);
assert(prop.isString());
return prop.toString();
}
} // namespace demo