MCPcopy Create free account
hub / github.com/Tencent/puerts / GetFunctionFromValue

Function GetFunctionFromValue

unity/native_src/Src/Puerts.cpp:434–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434V8_EXPORT JSFunction *GetFunctionFromValue(v8::Isolate* Isolate, v8::Value *Value, int IsOut)
435{
436 if (IsOut)
437 {
438 auto Context = Isolate->GetCurrentContext();
439 auto Outer = Value->ToObject(Context).ToLocalChecked();
440 auto Realvalue = Outer->Get(Context, FV8Utils::V8String(Isolate, "value")).ToLocalChecked();
441 return GetFunctionFromValue(Isolate, *Realvalue, false);
442 }
443 else
444 {
445 auto Context = Isolate->GetCurrentContext();
446 auto Function = v8::Local<v8::Function>::Cast(Value->ToObject(Context).ToLocalChecked());
447 auto JsEngine = FV8Utils::IsolateData<JSEngine>(Isolate);
448 return JsEngine->CreateJSFunction(Isolate, Context, Function);
449 }
450}
451
452V8_EXPORT puerts::JSObject *GetJSObjectFromValue(v8::Isolate* Isolate, v8::Value *Value, int IsOut)
453{

Callers

nothing calls this directly

Calls 5

CastFunction · 0.85
ToObjectMethod · 0.80
CreateJSFunctionMethod · 0.80
ToLocalCheckedMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected