@@ -33742,6 +33742,30 @@ static JSValue js_global_isFinite(JSContext *ctx, JSValueConst this_val,
33742
33742
return JS_NewBool(ctx, res);
33743
33743
}
33744
33744
33745
+ static JSValue js_microtask_job(JSContext *ctx,
33746
+ int argc, JSValueConst *argv)
33747
+ {
33748
+ JSValueConst func = argv[0];
33749
+ JSValue ret = JS_Call(ctx, func, ctx->global_obj, 0, NULL);
33750
+ if (JS_IsException(ret))
33751
+ return ret;
33752
+ JS_FreeValue(ctx, ret);
33753
+ return JS_UNDEFINED;
33754
+ }
33755
+
33756
+ static JSValue js_global_queueMicrotask(JSContext *ctx, JSValueConst this_val,
33757
+ int argc, JSValueConst *argv)
33758
+ {
33759
+ if (check_function(ctx, argv[0]))
33760
+ return JS_EXCEPTION;
33761
+
33762
+ JSValueConst args[1];
33763
+ args[0] = argv[0];
33764
+ if (JS_EnqueueJob(ctx, js_microtask_job, 1, args))
33765
+ return JS_EXCEPTION;
33766
+ return JS_UNDEFINED;
33767
+ }
33768
+
33745
33769
/* Object class */
33746
33770
33747
33771
static JSValue JS_ToObject(JSContext *ctx, JSValueConst val)
@@ -45680,6 +45704,7 @@ static const JSCFunctionListEntry js_global_funcs[] = {
45680
45704
JS_CFUNC_DEF("parseFloat", 1, js_parseFloat ),
45681
45705
JS_CFUNC_DEF("isNaN", 1, js_global_isNaN ),
45682
45706
JS_CFUNC_DEF("isFinite", 1, js_global_isFinite ),
45707
+ JS_CFUNC_DEF("queueMicrotask", 1, js_global_queueMicrotask ),
45683
45708
45684
45709
JS_CFUNC_MAGIC_DEF("decodeURI", 1, js_global_decodeURI, 0 ),
45685
45710
JS_CFUNC_MAGIC_DEF("decodeURIComponent", 1, js_global_decodeURI, 1 ),
0 commit comments