modified: qjs.c
This commit is contained in:
parent
5f280254fa
commit
af4c40ce41
1 changed files with 3 additions and 2 deletions
5
qjs.c
5
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"
|
||||
|
|
Loading…
Add table
Reference in a new issue