now all executes can be applyed to CronDateTimeScheduler

This commit is contained in:
InsanusMokrassar 2019-10-08 22:15:00 +06:00
parent d1a2b20792
commit d1f84ee136

View File

@ -1,27 +1,25 @@
package com.github.insanusmokrassar.krontab
suspend inline fun executeWith(
scheduler: CronDateTimeScheduler,
noinline block: suspend () -> Boolean
) = scheduler.doInLoop(block)
suspend inline fun executeInfinity(
scheduleConfig: String,
noinline block: suspend () -> Unit
) = createCronDateTimeScheduler(scheduleConfig).doInLoop {
suspend inline fun CronDateTimeScheduler.executeInfinity(noinline block: suspend () -> Unit) = doInLoop {
block()
true
}
suspend inline fun executeInfinity(
scheduleConfig: String,
noinline block: suspend () -> Unit
) = createCronDateTimeScheduler(scheduleConfig).executeInfinity(block)
suspend inline fun CronDateTimeScheduler.executeWhile(noinline block: suspend () -> Boolean) = doInLoop(block)
suspend inline fun executeWhile(
scheduleConfig: String,
noinline block: suspend () -> Boolean
) = createCronDateTimeScheduler(scheduleConfig).doInLoop(block)
) = createCronDateTimeScheduler(scheduleConfig).executeWhile(block)
suspend inline fun executeOnce(
scheduleConfig: String,
noinline block: suspend () -> Unit
) = createCronDateTimeScheduler(scheduleConfig).doInLoop {
suspend inline fun CronDateTimeScheduler.executeOnce(noinline block: suspend () -> Unit) = doInLoop {
block()
false
}
suspend inline fun executeOnce(
scheduleConfig: String,
noinline block: suspend () -> Unit
) = createCronDateTimeScheduler(scheduleConfig).executeOnce(block)