forked from BabylonJS/JsRuntimeHost
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppRuntime_JavaScriptCore.cpp
More file actions
35 lines (27 loc) · 855 Bytes
/
Copy pathAppRuntime_JavaScriptCore.cpp
File metadata and controls
35 lines (27 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "AppRuntime.h"
#include <napi/env.h>
namespace Babylon
{
void AppRuntime::RunEnvironmentTier(const char*)
{
auto globalContext = JSGlobalContextCreateInGroup(nullptr, nullptr);
#if __APPLE__
if (__builtin_available(iOS 16.4, macOS 13.3, *))
{
JSGlobalContextSetInspectable(globalContext, m_options.EnableDebugger);
}
#endif
Napi::Env env = Napi::Attach(globalContext);
Run(env);
JSGlobalContextRelease(globalContext);
// Detach must come after JSGlobalContextRelease since it triggers finalizers which require env.
Napi::Detach(env);
}
void AppRuntime::ShutdownEnvironment(Napi::Env)
{
}
void AppRuntime::DrainMicrotasks(Napi::Env)
{
// JavaScriptCore drains microtasks automatically at script boundaries.
}
}