@@ -33742,6 +33742,30 @@ static JSValue js_global_isFinite(JSContext *ctx, JSValueConst this_val,
3374233742 return JS_NewBool(ctx, res);
3374333743}
3374433744
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+
3374533769/* Object class */
3374633770
3374733771static JSValue JS_ToObject(JSContext *ctx, JSValueConst val)
@@ -45680,6 +45704,7 @@ static const JSCFunctionListEntry js_global_funcs[] = {
4568045704 JS_CFUNC_DEF("parseFloat", 1, js_parseFloat ),
4568145705 JS_CFUNC_DEF("isNaN", 1, js_global_isNaN ),
4568245706 JS_CFUNC_DEF("isFinite", 1, js_global_isFinite ),
45707+ JS_CFUNC_DEF("queueMicrotask", 1, js_global_queueMicrotask ),
4568345708
4568445709 JS_CFUNC_MAGIC_DEF("decodeURI", 1, js_global_decodeURI, 0 ),
4568545710 JS_CFUNC_MAGIC_DEF("decodeURIComponent", 1, js_global_decodeURI, 1 ),
0 commit comments