perf: useThrottle 500L

This commit is contained in:
lisonge 2024-01-20 13:50:31 +08:00
parent 2ba1292489
commit 9f239fa72f

View File

@ -36,7 +36,7 @@ fun Long.format(formatStr: String): String {
return df.format(this)
}
fun useThrottle(interval: Long = 1000L): (fn: () -> Unit) -> Unit {
fun useThrottle(interval: Long = 500L): (fn: () -> Unit) -> Unit {
var lastTriggerTime = 0L
return { fn ->
val t = System.currentTimeMillis()