add doc for SingleAlarm

GitOrigin-RevId: 68a35ed4351e01ab44fedf2e0121de4ab6e2196b
This commit is contained in:
Max Medvedev
2024-05-14 10:15:37 +00:00
committed by intellij-monorepo-bot
parent 1dd10b2cfc
commit 7ba74edcce
@@ -10,6 +10,14 @@ import java.util.concurrent.ExecutionException
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeoutException
/**
* Allows scheduling a single `Runnable` instance ([task]) to be executed after a specific time interval on a specific thread.
* [request] adds a request if it's not scheduled yet, i.e., it does not delay execution of the request
* [cancelAndRequest] cancels the current request and schedules a new one instead, i.e., it delays execution of the request
*
* Consider using a [kotlinx.coroutines.flow.Flow] with [kotlinx.coroutines.flow.debounce] and [kotlinx.coroutines.flow.sample] instead
*/
class SingleAlarm @JvmOverloads constructor(
private val task: Runnable,
private val delay: Int,