Hello. I use V8 to implement scripting in the program. There is such a function on JS:
__loadSubScene(name, pathToSceneDescriptor, loadPhysics, (err) => { alert('Scene was loaded!'); }); as well as a C ++ handler:
void APIFunctions::__loadSubScene(const v8::FunctionCallbackInfo<v8::Value>& args) { if (args.Length() == 4) { v8::String::Utf8Value v8SceneName(args[0]); std::string name = ConvertUtils::toString(*v8SceneName); v8::String::Utf8Value v8Path(args[1]); std::string path = ConvertUtils::toString(*v8Path); v8::Local<v8::Boolean> isLoadPhysics = args[2]->ToBoolean(); v8::Handle<v8::Function> callback = v8::Handle<v8::Function>::Cast(args[3]); TLMFacade::getInstance().loadSubScene(ConvertUtils::toWstring(name), ConvertUtils::toWstring(path), isLoadPhysics->BooleanValue(), [=](void* _result) { // функция должна быть вызвана здесь }); } } When I call a callback from C ++, I get an error. Perhaps someone knows the rules by which to perform such actions or an example. Thank.