6.6.3 - Alpha - 新增 timers.keepAlive 方法 (已全局化)

This commit is contained in:
SuperMonster003
2025-04-19 16:41:02 +08:00
parent 49bccdff85
commit 2804f4990f
4 changed files with 43 additions and 9 deletions

View File

@@ -2,6 +2,9 @@
"$data": {
"v6.6.3": {
"released_date": "2025/04/19",
"feature": [
"timers.keepAlive 方法 (已全局化), 用于保持脚本活跃状态"
],
"fix": [
"主页文档标签显示在线文档时部分内容被系统导航栏遮挡的问题",
"部分设备代码编辑器空行显示方框字符的问题",

View File

@@ -698,6 +698,16 @@ class ColorTable {
const val GREY_700 = -0x9e9e9f
const val GREY_800 = -0xbdbdbe
const val GREY_900 = -0xdededf
const val GRAY_50 = -0x50506
const val GRAY_100 = -0xa0a0b
const val GRAY_200 = -0x111112
const val GRAY_300 = -0x1f1f20
const val GRAY_400 = -0x424243
const val GRAY_500 = -0x616162
const val GRAY_600 = -0x8a8a8b
const val GRAY_700 = -0x9e9e9f
const val GRAY_800 = -0xbdbdbe
const val GRAY_900 = -0xdededf
const val BLACK_1000 = -0x1000000
const val WHITE_1000 = -0x1
const val BLUE_GREY_50 = -0x13100f
@@ -710,6 +720,16 @@ class ColorTable {
const val BLUE_GREY_700 = -0xbaa59c
const val BLUE_GREY_800 = -0xc8b8b1
const val BLUE_GREY_900 = -0xd9cdc8
const val BLUE_GRAY_50 = -0x13100f
const val BLUE_GRAY_100 = -0x302724
const val BLUE_GRAY_200 = -0x4f443b
const val BLUE_GRAY_300 = -0x6f5b52
const val BLUE_GRAY_400 = -0x876f64
const val BLUE_GRAY_500 = -0x9f8275
const val BLUE_GRAY_600 = -0xab9186
const val BLUE_GRAY_700 = -0xbaa59c
const val BLUE_GRAY_800 = -0xc8b8b1
const val BLUE_GRAY_900 = -0xd9cdc8
const val RED = RED_500
const val PINK = PINK_500
@@ -729,7 +749,9 @@ class ColorTable {
const val DEEP_ORANGE = DEEP_ORANGE_500
const val BROWN = BROWN_500
const val GREY = GREY_500
const val GRAY = GREY_500
const val BLUE_GREY = BLUE_GREY_500
const val BLUE_GRAY = BLUE_GREY_500
const val BLACK = BLACK_1000
const val WHITE = WHITE_1000

View File

@@ -20,6 +20,7 @@ open class Timers(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
override val selfAssignmentFunctions = listOf(
::setIntervalExt.name,
::keepAlive.name,
)
override val globalAssignmentFunctions = listOf(
@@ -30,13 +31,14 @@ open class Timers(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
::clearInterval.name,
::clearImmediate.name,
::loop.name,
::keepAlive.name,
)
companion object : FlexibleArray() {
@JvmStatic
@RhinoRuntimeFunctionInterface
fun setTimeout(scriptRuntime: ScriptRuntime, args: Array<out Any?>) = ensureArgumentsAtLeast(args, 1) {
fun setTimeout(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Double = ensureArgumentsAtLeast(args, 1) {
val (callbackArg, intervalArg) = it
val callback = coerceFunction(callbackArg)
val interval = coerceLongNumber(intervalArg, 1L)
@@ -49,13 +51,13 @@ open class Timers(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
@JvmStatic
@RhinoRuntimeFunctionInterface
fun clearTimeout(scriptRuntime: ScriptRuntime, args: Array<out Any?>) = ensureArgumentsOnlyOne(args) {
fun clearTimeout(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsOnlyOne(args) {
scriptRuntime.timers.clearTimeout(coerceNumber(it))
}
@JvmStatic
@RhinoRuntimeFunctionInterface
fun setInterval(scriptRuntime: ScriptRuntime, args: Array<out Any?>) = ensureArgumentsAtLeast(args, 1) {
fun setInterval(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Double = ensureArgumentsAtLeast(args, 1) {
val (callbackArg, intervalArg) = it
val callback = coerceFunction(callbackArg)
val interval = coerceLongNumber(intervalArg, 1L)
@@ -68,13 +70,13 @@ open class Timers(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
@JvmStatic
@RhinoRuntimeFunctionInterface
fun clearInterval(scriptRuntime: ScriptRuntime, args: Array<out Any?>) = ensureArgumentsOnlyOne(args) {
fun clearInterval(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsOnlyOne(args) {
scriptRuntime.timers.clearInterval(coerceNumber(it))
}
@JvmStatic
@RhinoRuntimeFunctionInterface
fun setImmediate(scriptRuntime: ScriptRuntime, args: Array<out Any?>) = ensureArgumentsAtLeast(args, 1) {
fun setImmediate(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Double = ensureArgumentsAtLeast(args, 1) {
val (callbackArg) = it
val callback = coerceFunction(callbackArg)
when (it.size) {
@@ -85,7 +87,7 @@ open class Timers(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
@JvmStatic
@RhinoRuntimeFunctionInterface
fun clearImmediate(scriptRuntime: ScriptRuntime, args: Array<out Any?>) = ensureArgumentsOnlyOne(args) {
fun clearImmediate(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsOnlyOne(args) {
scriptRuntime.timers.clearImmediate(coerceNumber(it))
}
@@ -98,6 +100,13 @@ open class Timers(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
UNDEFINED
}
@JvmStatic
@RhinoRuntimeFunctionInterface
fun keepAlive(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Double = ensureArgumentsAtMost(args, 1) {
val (internal) = it
setInterval(scriptRuntime, arrayOf(BaseFunction(), coerceNumber(internal, 10_000)))
}
@JvmStatic
@RhinoRuntimeFunctionInterface
fun setIntervalExt(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Double = ensureArgumentsLengthInRange(args, 1..4) {

View File

@@ -1,5 +1,5 @@
#Sat Apr 19 02:00:10 CST 2025
BUILD_TIME=1744999210778
#Sat Apr 19 16:35:05 CST 2025
BUILD_TIME=1745051705674
COMPILE_SDK_VERSION=35
JAVA_VERSION=23
JAVA_VERSION_MIN_RADICAL=0
@@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
TARGET_SDK_VERSION=35
TARGET_SDK_VERSION_INRT=29
VERSION_BUILD=3150
VERSION_BUILD=3152
VERSION_NAME=6.6.3 Alpha
VSCODE_EXT_REQUIRED_VERSION=1.0.8