hastebrot
01/03/2017, 9:54 AMkotlin.concurrent.timer.
fun setInterval(millis: Long,
action: () -> Unit) = timer("setInterval", true, millis, millis) { action() }
fun setTimeout(millis: Long,
action: () -> Unit) = timer("setTimeout", true, millis, 0) { action() }
fun setImmediate(millis: Long,
action: () -> Unit) = timer("setImmediate", true, 0, 0) { action() }
Unfortunately timer() requires the period parameter to be > 0 (i.e. the last 0 in setTimout() and setImmediate()).