This commit is contained in:
InsanusMokrassar 2022-06-15 13:31:26 +06:00
parent 8ac6cd3e62
commit 2abef58335
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,13 @@
package dev.inmo.krontab
import com.soywiz.klock.DateTime
class LambdaKronScheduler(
private val onNext: suspend (DateTime) -> DateTime?
) : KronScheduler {
override suspend fun next(relatively: DateTime): DateTime? = onNext(relatively)
}
fun KronScheduler(
onNext: suspend (DateTime) -> DateTime?
) = LambdaKronScheduler(onNext)

View File

@ -0,0 +1,13 @@
package dev.inmo.krontab
import com.soywiz.klock.DateTimeTz
class LambdaKronSchedulerTz(
private val onNext: suspend (DateTimeTz) -> DateTimeTz?
) : KronSchedulerTz {
override suspend fun next(relatively: DateTimeTz): DateTimeTz? = onNext(relatively)
}
fun KronSchedulerTz(
onNext: suspend (DateTimeTz) -> DateTimeTz?
) = LambdaKronSchedulerTz(onNext)