mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2024-11-22 16:23:55 +00:00
Hotfix for 0.6.5 flows
This commit is contained in:
parent
89a6a305f8
commit
2f3796733d
@ -12,12 +12,12 @@ import kotlinx.coroutines.flow.*
|
|||||||
* time zones
|
* time zones
|
||||||
*
|
*
|
||||||
* @see channelFlow
|
* @see channelFlow
|
||||||
* @see KronSchedulerTz.doWhile
|
* @see KronSchedulerTz.doInfinityTz
|
||||||
*/
|
*/
|
||||||
@FlowPreview
|
@FlowPreview
|
||||||
fun KronSchedulerTz.asTzFlow(): Flow<DateTimeTz> = channelFlow {
|
fun KronScheduler.asTzFlow(): Flow<DateTimeTz> = channelFlow {
|
||||||
doInfinity {
|
doInfinityTz {
|
||||||
send(DateTime.nowLocal())
|
send(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,29 +25,15 @@ fun KronSchedulerTz.asTzFlow(): Flow<DateTimeTz> = channelFlow {
|
|||||||
* This method is a map for [asTzFlow] and will works the same but return flow with [DateTime]s
|
* This method is a map for [asTzFlow] and will works the same but return flow with [DateTime]s
|
||||||
*
|
*
|
||||||
* @see channelFlow
|
* @see channelFlow
|
||||||
* @see KronScheduler.doWhile
|
* @see KronScheduler.doInfinityLocal
|
||||||
*/
|
*/
|
||||||
@FlowPreview
|
@FlowPreview
|
||||||
fun KronScheduler.asFlow(): Flow<DateTime> = channelFlow {
|
fun KronScheduler.asFlow(): Flow<DateTime> = channelFlow {
|
||||||
doInfinity {
|
doInfinityLocal {
|
||||||
send(DateTime.now())
|
send(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This [Flow] will trigger emitting each near time which will be returned from [this] [KronScheduler] with attention to
|
|
||||||
* time zones
|
|
||||||
*
|
|
||||||
* @see channelFlow
|
|
||||||
* @see KronScheduler.asFlow
|
|
||||||
* @see KronSchedulerTz.asTzFlow
|
|
||||||
*/
|
|
||||||
@FlowPreview
|
|
||||||
fun KronScheduler.asTzFlow(): Flow<DateTimeTz> = when (this) {
|
|
||||||
is KronSchedulerTz -> asTzFlow()
|
|
||||||
else -> asFlow().map { it.local }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
"It is not recommended to use this class in future. This functionality will be removed soon",
|
"It is not recommended to use this class in future. This functionality will be removed soon",
|
||||||
ReplaceWith("asFlow", "dev.inmo.krontab.utils.asFlow")
|
ReplaceWith("asFlow", "dev.inmo.krontab.utils.asFlow")
|
||||||
|
Loading…
Reference in New Issue
Block a user