GlokTimer

class GlokTimer(val delay: Double, val repeating: Boolean = false, val action: () -> Unit) : Comparable<GlokTimer>

Runs code after a given time interval. This is not a high precision timer, there is no guarantee about how soon after delay milliseconds, the action will be performed.

The timer is not started on creation. You must call start.

delay is measured in milliseconds, and stored as a Double for compatibility with javascript, which doesn't support the Long type.

If repeating == false, action is performed only once, and then the timer stops. Otherwise, action will be repeated every delay milliseconds until the timer is stopped.

Constructors

Link copied to clipboard
constructor(delay: Double, repeating: Boolean = false, action: () -> Unit)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val action: () -> Unit
Link copied to clipboard
Link copied to clipboard
val repeating: Boolean = false

Functions

Link copied to clipboard
open operator override fun compareTo(other: GlokTimer): Int

Allows timers to be ordered by the time they are next due to fire.

Link copied to clipboard

A timer is not started on creation, so this must be called at least once for the timer to have any effect.

Link copied to clipboard
fun stop()