added jsvm sleep binding

This commit is contained in:
Gani Georgiev
2023-12-29 22:31:50 +02:00
parent 64cee264f0
commit c4116e3a7d
5 changed files with 4531 additions and 4472 deletions

View File

@@ -299,6 +299,10 @@ func baseBinds(vm *goja.Runtime) {
return string(bodyBytes), nil
})
vm.Set("sleep", func(milliseconds int64) {
time.Sleep(time.Duration(milliseconds) * time.Millisecond)
})
vm.Set("arrayOf", func(model any) any {
mt := reflect.TypeOf(model)
st := reflect.SliceOf(mt)