mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2024-06-26 11:37:59 +00:00
Compare commits
No commits in common. "master" and "v2.2.9" have entirely different histories.
|
@ -1,9 +1,5 @@
|
|||
# Changelog
|
||||
|
||||
## 2.3.0
|
||||
|
||||
* `doWhile` now will guarantee that it will not call `doOnce` more than once for time
|
||||
|
||||
## 2.2.9
|
||||
|
||||
* `Version`:
|
||||
|
|
|
@ -36,5 +36,5 @@ androidx_work_version=2.9.0
|
|||
|
||||
## Common
|
||||
|
||||
version=2.3.0
|
||||
android_code_version=40
|
||||
version=2.2.9
|
||||
android_code_version=39
|
||||
|
|
|
@ -71,18 +71,9 @@ suspend inline fun <T> doOnceTz(
|
|||
* Will execute [block] while it will return true as a result of its calculation
|
||||
*/
|
||||
suspend inline fun KronScheduler.doWhile(block: (DateTime) -> Boolean) {
|
||||
var latest: DateTime? = null
|
||||
do {
|
||||
delay(1L)
|
||||
val result = doOnce {
|
||||
if (latest != it) {
|
||||
latest = it
|
||||
block(it)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
} while (result == null || result)
|
||||
} while (doOnce(block))
|
||||
}
|
||||
/**
|
||||
* Will execute [block] while it will return true as a result of its calculation
|
||||
|
@ -94,18 +85,9 @@ suspend inline fun KronScheduler.doWhileLocal(block: (DateTime) -> Boolean) = do
|
|||
* Will execute [block] while it will return true as a result of its calculation
|
||||
*/
|
||||
suspend inline fun KronScheduler.doWhileTz(noinline block: suspend (DateTimeTz) -> Boolean) {
|
||||
var latest: DateTimeTz? = null
|
||||
do {
|
||||
delay(1L)
|
||||
val result = doOnceTz {
|
||||
if (latest != it) {
|
||||
latest = it
|
||||
block(it)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
} while (result == null || result)
|
||||
} while (doOnceTz(block))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user