mirror of
https://github.com/stashapp/stash.git
synced 2025-12-07 08:54:10 +01:00
22 lines
370 B
Go
22 lines
370 B
Go
package js
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/robertkrimen/otto"
|
|
)
|
|
|
|
func sleepFunc(call otto.FunctionCall) otto.Value {
|
|
arg := call.Argument(0)
|
|
ms, _ := arg.ToInteger()
|
|
|
|
time.Sleep(time.Millisecond * time.Duration(ms))
|
|
return otto.UndefinedValue()
|
|
}
|
|
|
|
func AddUtilAPI(vm *otto.Otto) {
|
|
util, _ := vm.Object("({})")
|
|
util.Set("Sleep", sleepFunc)
|
|
|
|
vm.Set("util", util)
|
|
}
|