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

transform + reduce async iterable cancellation #24

Closed
richytong opened this issue Jun 11, 2020 · 1 comment · Fixed by #27
Closed

transform + reduce async iterable cancellation #24

richytong opened this issue Jun 11, 2020 · 1 comment · Fixed by #27
Assignees
Labels
enhancement New feature or request

Comments

@richytong
Copy link
Collaborator

richytong commented Jun 11, 2020

this issue names transducers as a workaround for early cancellation of async iterables. Transducer enabled functions reduce and transform are in a great position to cancel async iteration because they control the for await...of loop that started the async iteration

async iterable cancellation is desirable for example in front-end applications where you may be streaming data at a time and when the user navigates away you should not care about streaming data anymore and cancel at that point.

I like this API

const myOngoingTaskPromise = transform(f, null)(myInfiniteSource)
myOngoingTaskPromise.cancel() // like Bluebird
@richytong richytong added enhancement New feature or request help wanted Extra attention is needed labels Jun 11, 2020
@richytong richytong self-assigned this Jun 11, 2020
@richytong richytong removed the help wanted Extra attention is needed label Jun 11, 2020
@richytong
Copy link
Collaborator Author

nice one

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

Successfully merging a pull request may close this issue.

1 participant