aboutsummaryrefslogtreecommitdiff
path: root/nginx/ngx_js.c
diff options
context:
space:
mode:
authorDmitry Volyntsev <xeioex@nginx.com>2024-10-31 17:47:41 -0700
committerDmitry Volyntsev <xeioexception@gmail.com>2024-11-06 08:16:46 -0800
commit98fff325573c3554203e7cbc467066f7c8a45c2c (patch)
treea00839b10e7de48b57e89f93154f0d9ed7f91081 /nginx/ngx_js.c
parent352c2e594e57d2bce11f7e2a773dcab417182ef1 (diff)
downloadnjs-98fff325573c3554203e7cbc467066f7c8a45c2c.tar.gz
njs-98fff325573c3554203e7cbc467066f7c8a45c2c.zip
QuickJS: reworked process object.
Diffstat (limited to 'nginx/ngx_js.c')
-rw-r--r--nginx/ngx_js.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/nginx/ngx_js.c b/nginx/ngx_js.c
index f70288cf..1ac53baa 100644
--- a/nginx/ngx_js.c
+++ b/nginx/ngx_js.c
@@ -70,6 +70,7 @@ static ngx_int_t ngx_engine_qjs_pending(ngx_engine_t *engine);
static ngx_int_t ngx_engine_qjs_string(ngx_engine_t *e,
njs_opaque_value_t *value, ngx_str_t *str);
+static JSValue ngx_qjs_process_getter(JSContext *ctx, JSValueConst this_val);
static JSValue ngx_qjs_ext_set_timeout(JSContext *cx, JSValueConst this_val,
int argc, JSValueConst *argv, int immediate);
static JSValue ngx_qjs_ext_clear_timeout(JSContext *cx, JSValueConst this_val,
@@ -457,6 +458,7 @@ static const JSCFunctionListEntry ngx_qjs_ext_console[] = {
static const JSCFunctionListEntry ngx_qjs_ext_global[] = {
+ JS_CGETSET_DEF("process", ngx_qjs_process_getter, NULL),
JS_CFUNC_MAGIC_DEF("setTimeout", 1, ngx_qjs_ext_set_timeout, 0),
JS_CFUNC_MAGIC_DEF("setImmediate", 1, ngx_qjs_ext_set_timeout, 1),
JS_CFUNC_DEF("clearTimeout", 1, ngx_qjs_ext_clear_timeout),
@@ -1567,6 +1569,13 @@ ngx_qjs_clear_timer(ngx_qjs_event_t *event)
static JSValue
+ngx_qjs_process_getter(JSContext *cx, JSValueConst this_val)
+{
+ return qjs_process_object(cx, ngx_argc, (const char **) ngx_argv);
+}
+
+
+static JSValue
ngx_qjs_ext_set_timeout(JSContext *cx, JSValueConst this_val, int argc,
JSValueConst *argv, int immediate)
{