mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 11:42:22 +08:00
perf: useThrottle 500L
This commit is contained in:
parent
2ba1292489
commit
9f239fa72f
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue
Block a user