feat(scripting): sleep

This commit is contained in:
rhunk
2023-12-27 11:55:29 +01:00
parent fe5c6306e1
commit a249d41887
3 changed files with 19 additions and 4 deletions

View File

@ -80,6 +80,12 @@ class JSModule(
field.get(obj.unwrap())
}
moduleObject.putFunction("sleep") { args ->
val time = args?.get(0) as? Number ?: return@putFunction Undefined.instance
Thread.sleep(time.toLong())
Undefined.instance
}
moduleObject.putFunction("findClass") {
val className = it?.get(0).toString()
val useModClassLoader = it?.getOrNull(1) as? Boolean ?: false