diff options
author | bptato <nincsnevem662@gmail.com> | 2023-12-25 00:11:14 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-12-25 00:16:08 +0100 |
commit | 1bc63e1cd59bff8e7e266bec80ba961fecf772b7 (patch) | |
tree | ada6fa013d78d672da25c1d566458d8503b63ddb /src/js | |
parent | e34eb7093944aac9dac543bcf97b77c868251b10 (diff) | |
download | chawan-1bc63e1cd59bff8e7e266bec80ba961fecf772b7.tar.gz |
dom: use JS_EvalFunction; add module fetching stubs
(still no module support in buffer...)
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/javascript.nim | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim index f402655c..73fd5850 100644 --- a/src/js/javascript.nim +++ b/src/js/javascript.nim @@ -1612,6 +1612,13 @@ proc eval*(ctx: JSContext, s: string, file: string, eval_flags: int): JSValue = return JS_Eval(ctx, cstring(s), csize_t(s.len), cstring(file), cint(eval_flags)) +proc compileScript*(ctx: JSContext, s: string, file: cstring): JSValue = + return JS_Eval(ctx, cstring(s), csize_t(s.len), file, + cint(JS_EVAL_FLAG_COMPILE_ONLY)) + proc compileModule*(ctx: JSContext, s: string, file: cstring): JSValue = return JS_Eval(ctx, cstring(s), csize_t(s.len), file, cint(JS_EVAL_TYPE_MODULE or JS_EVAL_FLAG_COMPILE_ONLY)) + +proc evalFunction*(ctx: JSContext, val: JSValue): JSValue = + return JS_EvalFunction(ctx, val) |