allow 'await' in the REPL and added os.sleepAsync()

This commit is contained in:
Fabrice Bellard
2024-01-02 16:09:30 +01:00
parent 8de4538ff3
commit e44b793e38
5 changed files with 123 additions and 48 deletions

View File

@@ -368,6 +368,9 @@ optional properties:
@item backtrace_barrier
Boolean (default = false). If true, error backtraces do not list the
stack frames below the evalScript.
@item async
Boolean (default = false). If true, @code{await} is accepted in the
script and a promise is returned.
@end table
@item loadScript(filename)
@@ -769,6 +772,12 @@ write_fd]} or null in case of error.
@item sleep(delay_ms)
Sleep during @code{delay_ms} milliseconds.
@item sleepAsync(delay_ms)
Asynchronouse sleep during @code{delay_ms} milliseconds. Returns a promise. Example:
@example
await os.sleepAsync(500);
@end example
@item now()
Return a timestamp in milliseconds with more precision than
@code{Date.now()}. The time origin is unspecified and is normally not