Skip to content

Deprecate delayFlow and delayEach #1429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
elizarov opened this issue Aug 9, 2019 · 4 comments
Closed

Deprecate delayFlow and delayEach #1429

elizarov opened this issue Aug 9, 2019 · 4 comments

Comments

@elizarov
Copy link
Contributor

elizarov commented Aug 9, 2019

This will make Flow API surface more orthogonal with less operators to remember. Both of them can be easily written without too much additional code and still produce quite readable and easy to understand code:

delayFlow(time) = onStart { delay(time) }
delayEach(time) = onEach { delay(time) }
@elizarov elizarov changed the title Depreate delayFlow and delayEach Deprecate delayFlow and delayEach Aug 9, 2019
elizarov added a commit that referenced this issue Aug 9, 2019
This will make Flow API surface more orthogonal with less operators to
remember. Both of them can be easily written without too much additional
code and still produce quite readable and easy to understand code:

delayFlow(time) = onStart { delay(time) }
delayEach(time) = onEach { delay(time) }

Fixes #1429
@Augusent
Copy link

Augusent commented Aug 9, 2019

And what about prospective delayFlow(Flow) case? Wouldn't it be too verbose to follow onStart { ... } approach in this case?

@elizarov
Copy link
Contributor Author

elizarov commented Aug 9, 2019

onStart { delay(xxx) } seems to be more explicit than delayFlow. Moreover, it is composable with all the delay extension. For example, if you use kotlinx-coroutines-jdk8 module you can write onStart { delay(1, TimeUnit.SECONDS) } without having to also introduce the corresponding extensions for all the flow operators.

@Augusent
Copy link

Augusent commented Aug 9, 2019

Yes, it surely is. But I meant more like delaySubscription(Observable) analogy from rx world. When a subscription (collection) of a flow is triggered after the first emission of the delayFlow's argument flow source.

@elizarov
Copy link
Contributor Author

elizarov commented Aug 9, 2019

If you have a use-case for delaySubscription in mind, then please open a separate issue for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants