class

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(*, raw : Bool)
Source

Instance methods

call(function : ValueWrapper, this_obj : ValueWrapper, arguments : Array(ValueWrapper) = [] of ValueWrapper, same_thread : Bool = true) : ValueWrapper
Source
close

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.

Source
closed?
Source
context
Source
create_value(value) : ValueWrapper
Source
drain_jobs
Source
eval_string(input : String, eval_flag : QuickJS::EvalFlag = QuickJS::EvalFlag::STRICT, etag : String = "<input>", same_thread : Bool = true) : ValueWrapper
Source
eval_this(this_obj : ValueWrapper, input : String, eval_flag : QuickJS::EvalFlag = QuickJS::EvalFlag::STRICT, etag : String = "<input>", same_thread : Bool = true) : ValueWrapper
Source
finalize
Source
runtime
Source

Nested types