From af4c40ce41e84901ab6668f1ee98d24915defbf7 Mon Sep 17 00:00:00 2001 From: Sneed Group Holder Date: Fri, 25 Oct 2024 11:34:47 -0500 Subject: [PATCH] modified: qjs.c --- qjs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qjs.c b/qjs.c index 0254aa2..e612d89 100644 --- a/qjs.c +++ b/qjs.c @@ -528,11 +528,12 @@ int main(int argc, char **argv) "globalThis.global = globalThis;\n" "global.console.error = console.log\n" "global.console.warn = console.log\n" + "globalThis.break = () => { throw new Error('Break'); };\n" "\n" "if (typeof os !== 'undefined') {\n" " globalThis.sleep = os.sleep;\n" - " async function setTimeout(func, ms) { let cleared = false; await sleep(ms); if (!cleared) { func(); } return function clearTimeout() { cleared = true } }\n" - " globalThis.setTimeout = setTimeout\n" + " async function setTimeout2(func, ms) {globalThis.clearTimeout = false; await sleep(ms); if (!clearTimeout) { func(); } }\n" + " globalThis.setTimeout = setTimeout2\n" "} else {\n" " console.error('os is not defined.');\n" "}\n"