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:
@@ -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)) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user