MCPcopy Create free account
hub / github.com/BabylonJS/BabylonNative / RequestAnimationFrame

Method RequestAnimationFrame

Plugins/NativeEngine/Source/NativeEngine.cpp:647–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

645 }
646
647 void NativeEngine::RequestAnimationFrame(const Napi::CallbackInfo& info)
648 {
649 auto callback = info[0].As<Napi::Function>();
650
651 if (m_requestAnimationFrameCalback.IsEmpty() ||
652 m_requestAnimationFrameCalback.Value() != callback)
653 {
654 m_requestAnimationFrameCalback = Napi::Persistent(callback);
655 }
656
657 m_runtime.Dispatch([this](Napi::Env env) {
658 try
659 {
660 m_requestAnimationFrameCalback.Call({});
661 EndFrame();
662 }
663 catch (const std::exception& ex)
664 {
665 Napi::Error::New(env, ex.what()).ThrowAsJavaScriptException();
666 }
667 });
668 }
669
670 Napi::Value NativeEngine::CreateVertexArray(const Napi::CallbackInfo& info)
671 {

Callers

nothing calls this directly

Calls 7

PersistentFunction · 0.85
IsEmptyMethod · 0.80
ValueMethod · 0.80
CallMethod · 0.80
whatMethod · 0.80
DispatchMethod · 0.45

Tested by

no test coverage detected