File tree 2 files changed +26
-20
lines changed
kotlinx-coroutines-core/common/src/flow
2 files changed +26
-20
lines changed Original file line number Diff line number Diff line change 8
8
9
9
package kotlinx.coroutines.flow
10
10
11
+ import kotlinx.coroutines.*
12
+ import kotlinx.coroutines.flow.internal.*
13
+ import kotlinx.coroutines.flow.internal.unsafeFlow
11
14
import kotlin.coroutines.*
12
15
import kotlin.jvm.*
13
16
@@ -361,3 +364,26 @@ public fun <T> Flow<T>.concatWith(value: T): Flow<T> = noImpl()
361
364
)
362
365
public fun <T > Flow<T>.concatWith (other : Flow <T >): Flow <T > = noImpl()
363
366
367
+ /* *
368
+ * Delays the emission of values from this flow for the given [timeMillis].
369
+ * Use `onStart { delay(timeMillis) }`.
370
+ * @suppress
371
+ */
372
+ @Deprecated(
373
+ level = DeprecationLevel .WARNING , // since 1.3.0, error in 1.4.0
374
+ message = " Use 'onStart { delay(timeMillis) }'" ,
375
+ replaceWith = ReplaceWith (" onStart { delay(timeMillis) }" )
376
+ )
377
+ public fun <T > Flow<T>.delayFlow (timeMillis : Long ): Flow <T > = onStart { delay(timeMillis) }
378
+
379
+ /* *
380
+ * Delays each element emitted by the given flow for the given [timeMillis].
381
+ * Use `onEach { delay(timeMillis) }`.
382
+ * @suppress
383
+ */
384
+ @Deprecated(
385
+ level = DeprecationLevel .WARNING , // since 1.3.0, error in 1.4.0
386
+ message = " Use 'onEach { delay(timeMillis) }'" ,
387
+ replaceWith = ReplaceWith (" onEach { delay(timeMillis) }" )
388
+ )
389
+ public fun <T > Flow<T>.delayEach (timeMillis : Long ): Flow <T > = onEach { delay(timeMillis) }
Original file line number Diff line number Diff line change @@ -14,26 +14,6 @@ import kotlinx.coroutines.selects.*
14
14
import kotlin.jvm.*
15
15
import kotlinx.coroutines.flow.internal.unsafeFlow as flow
16
16
17
- /* *
18
- * Delays the emission of values from this flow for the given [timeMillis].
19
- */
20
- @ExperimentalCoroutinesApi
21
- public fun <T > Flow<T>.delayFlow (timeMillis : Long ): Flow <T > = flow {
22
- delay(timeMillis)
23
- collect(this @flow)
24
- }
25
-
26
- /* *
27
- * Delays each element emitted by the given flow for the given [timeMillis].
28
- */
29
- @ExperimentalCoroutinesApi
30
- public fun <T > Flow<T>.delayEach (timeMillis : Long ): Flow <T > = flow {
31
- collect { value ->
32
- delay(timeMillis)
33
- emit(value)
34
- }
35
- }
36
-
37
17
/* *
38
18
* Returns a flow that mirrors the original flow, but filters out values
39
19
* that are followed by the newer values within the given [timeout][timeoutMillis].
You can’t perform that action at this time.
0 commit comments