with iOS, How to properly call javascript function from objective c?
I know eventually, we call this:
NSString *jscode=“console.log(‘something’);”;
BOOL tf= se::ScriptEngine::getInstance()->evalString([jscode UTF8String]);
but I am wondering whether we need the following? as this is not documented in official documents:
cocos2d::Director::getInstance()->getScheduler()->performFunctionInCocosThread(sendMsgToCocosJs);
with cocos creator 2.2
std::shared_ptr<Scheduler> scheduler=Application::getInstance()->getScheduler();
scheduler->performFunctionInCocosThread(sendMsgToCocosJs);
since Director is hidden.
anyone has any idea? thanks.