@@ -18,10 +18,11 @@ import kotlinx.coroutines.isActive
18
18
* Will emit all the [KronScheduler.next] as soon as possible. In case [KronScheduler.next] return null, flow will
19
19
* be completed
20
20
*
21
- * @param since Will be used as the first parameter for [KronScheduler.next] fun
21
+ * @param since Will be used as the first parameter for [KronScheduler.next] fun. If passed null, `flow`
22
+ * will always start since the moment of collecting start
22
23
*/
23
- fun KronScheduler.asTzFlowWithoutDelays (since : DateTimeTz = DateTime .nowLocal() ): Flow <DateTimeTz > = flow {
24
- var previous = since
24
+ fun KronScheduler.asTzFlowWithoutDelays (since : DateTimeTz ? = null ): Flow <DateTimeTz > = flow {
25
+ var previous = since ? : DateTime .nowLocal()
25
26
while (currentCoroutineContext().isActive) {
26
27
val next = next(previous) ? : break
27
28
emit(next)
@@ -57,10 +58,11 @@ fun KronScheduler.asTzFlow(): Flow<DateTimeTz> = asTzFlowWithDelays()
57
58
* Will emit all the [KronScheduler.next] as soon as possible. In case [KronScheduler.next] return null, flow will
58
59
* be completed
59
60
*
60
- * @param since Will be used as the first parameter for [KronScheduler.next] fun
61
+ * @param since Will be used as the first parameter for [KronScheduler.next] fun. If passed null, `flow`
62
+ * will always start since the moment of collecting start
61
63
*/
62
- fun KronScheduler.asFlowWithoutDelays (since : DateTime = DateTime .now() ): Flow <DateTime > = flow {
63
- var previous = since
64
+ fun KronScheduler.asFlowWithoutDelays (since : DateTime ? = null ): Flow <DateTime > = flow {
65
+ var previous = since ? : DateTime .now()
64
66
while (currentCoroutineContext().isActive) {
65
67
val next = next(previous) ? : break
66
68
emit(next)
0 commit comments