Skip to content
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

Make launchMolecule return a Job? #382

Open
IVIanuu opened this issue Feb 19, 2024 · 5 comments
Open

Make launchMolecule return a Job? #382

IVIanuu opened this issue Feb 19, 2024 · 5 comments

Comments

@IVIanuu
Copy link

IVIanuu commented Feb 19, 2024

It would be nice if launchMolecule would return a Job object to easily cancel it.

@JakeWharton
Copy link
Collaborator

How do we do that for the one which returns a StateFlow?

@IVIanuu
Copy link
Author

IVIanuu commented Feb 19, 2024

Oh sorry, this makes sense. I only used the overload with the emitter.

@IVIanuu IVIanuu closed this as completed Feb 19, 2024
@JakeWharton
Copy link
Collaborator

We're currently modeled after the Compose APIs which don't offer a job. The best way to get one today is to create a new scope with a dedicated job on which you call launchMolecule.

I would like to return a job, but the StateFlow-returning overload becomes annoying.

@IVIanuu
Copy link
Author

IVIanuu commented Feb 19, 2024

This is what i'm doing now, thank you.

@JakeWharton JakeWharton reopened this Feb 20, 2024
@JakeWharton
Copy link
Collaborator

I still might make this change for the emitter-based one. We actually were just talking about it internally early last week, coincidentally. For the StateFlow-returning one I could accept a nullable Job, perhaps, as a way to get a handle. Will think about 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