eval method
JSValue
eval(
- String input,
- String filename, {
- JSEvalType evalFlags = JSEvalType.GLOBAL,
- bool autoDispose = true,
JSEvalType.MODULE | JSEvalType.COMPILE_ONLY : Compile then run to be able to set import.meta, then invoke js_module_set_import_meta(ctx, ret, TRUE, is_main) ret = JS_Eval(ctx, (Utf8 *) dbuf.buf, dbuf_size - 1, filename, JS_EVAL_TYPE_MODULE | JS_EVAL_FLAG_COMPILE_ONLY); if (!JS_IsException(ret)) { js_module_set_import_meta(ctx, ret, TRUE, is_main); ret = JS_EvalFunction(ctx, ret); }
Implementation
JSValue eval(
String input,
String filename, {
JSEvalType evalFlags = JSEvalType.GLOBAL,
bool autoDispose = true,
}) =>
JSValue.ptr(
this,
JS_Eval(
_ref,
input.toNativeUtf8(),
utf8.encode(input).length,
filename.toNativeUtf8(),
evalFlags.value,
),
autoDispose: autoDispose,
);