class
Medusa::Engine
- Medusa::Engine
- Reference
- Object
Overview
Manages a QuickJS runtime and context for executing JavaScript code. Provides methods to evaluate JavaScript strings and call JavaScript functions, with support for same-thread execution and safer multithreaded handling.
Defined in:
medusa/engine.crConstant Summary
-
Log =
::Log.for(self)
Constructors
-
.new
Initializes the engine with a new runtime and context.
Instance Method Summary
-
#call(function : ValueWrapper, this : ValueWrapper, arguments : Array(ValueWrapper) = [] of ValueWrapper, same_thread : Bool = true) : ValueWrapper
Calls a JavaScript function with the given arguments and
this
context. - #context : Context
-
#create_value(value) : ValueWrapper
Creates a ValueWrapper for a given value, encapsulating context access.
-
#eval_string(input : String, eval_flag : QuickJS::Flag = QuickJS::Flag::STRICT, etag : String = "<input>", same_thread : Bool = true) : ValueWrapper
Evaluates a JavaScript string and returns the result as a ValueWrapper.
-
#finalize
Finalizes the engine, freeing the context and runtime.
- #runtime : Runtime
Constructor Detail
Instance Method Detail
Calls a JavaScript function with the given arguments and this
context.
Creates a ValueWrapper for a given value, encapsulating context access.
Evaluates a JavaScript string and returns the result as a ValueWrapper.