Medusa::Engine
Inherits Reference < Object
Manages a QuickJS runtime and context for executing JavaScript code.
IMPORTANT: Always call close when done. Do not rely solely on GC
finalization — Boehm GC runs finalizers in non-deterministic order.
Constants
Log = ::Log.for(self)
Constructors
new
Sourcenew(*, raw : Bool)
SourceInstance methods
call(function : ValueWrapper, this_obj : ValueWrapper, arguments : Array(ValueWrapper) = [] of ValueWrapper, same_thread : Bool = true) : ValueWrapper
Sourceclose
Shuts down the engine. The C++ FreeContextAndRuntime handles the QuickJS gc_obj_list assertion issue caused by Crystal ValueWrappers that haven't been GC'd yet.
closed?
Sourcecontext
Sourcecreate_value(value) : ValueWrapper
Sourcedrain_jobs
Sourceeval_string(input : String, eval_flag : QuickJS::EvalFlag = QuickJS::EvalFlag::STRICT, etag : String = "<input>", same_thread : Bool = true) : ValueWrapper
Sourceeval_this(this_obj : ValueWrapper, input : String, eval_flag : QuickJS::EvalFlag = QuickJS::EvalFlag::STRICT, etag : String = "<input>", same_thread : Bool = true) : ValueWrapper
Sourcefinalize
Sourceruntime
Source