1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

js: codegen & vlib fixes, replace the Game of Life CLI example (#12272)

This commit is contained in:
playX
2021-10-22 22:03:19 +03:00
committed by GitHub
parent 8a4756819a
commit 864d6eae6b
6 changed files with 107 additions and 23 deletions

View File

@@ -36,3 +36,9 @@ pub fn (t Time) local() Time {
// if it is not we should try to use Intl for getting local time.
return t
}
pub fn sleep(dur Duration) {
#let now = new Date().getTime()
#let toWait = BigInt(dur.val) / BigInt(time__millisecond)
#while (new Date().getTime() < now + Number(toWait)) {}
}