
main.web.timers.timeout.kt Maven / Gradle / Ivy
package web.timers
import kotlin.time.Duration
import kotlin.time.DurationUnit
sealed external interface Timeout
external fun setTimeout(
callback: () -> Unit,
ms: Int = definedExternally,
): Timeout
external fun clearTimeout(
timeoutId: Timeout,
)
// extensions
fun setTimeout(
delay: Duration,
callback: () -> Unit,
): Timeout =
setTimeout(
callback,
delay.toInt(DurationUnit.MILLISECONDS)
)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy