MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / CreateContext

Method CreateContext

src/openrct2/scripting/ScriptEngine.cpp:655–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

653}
654
655JSContext* ScriptEngine::CreateContext() const
656{
657 JSContext* newCtx = JS_NewContext(_runtime);
658 if (!newCtx)
659 {
660 throw std::runtime_error("QuickJS: cannot allocate JS context\n");
661 }
662 InitialiseContext(newCtx);
663
664 for (const auto& ext : _extensions)
665 {
666 ext.newContext(newCtx);
667 }
668 return newCtx;
669}
670
671void ScriptEngine::InitialiseContext(JSContext* ctx) const
672{

Callers 1

LoadMethod · 0.80

Calls 1

InitialiseContextFunction · 0.85

Tested by

no test coverage detected