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

add support for CancellationTokenSource and CancellationToken #623

Open
prabirshrestha opened this issue Dec 25, 2018 · 4 comments
Open

Comments

@prabirshrestha
Copy link

CancellationTokenSource examples:
https://docs.microsoft.com/en-us/dotnet/standard/threading/cancellation-in-managed-threads
https://github.com/axios/axios

Abort Controllers: https://developer.mozilla.org/en-US/docs/Web/API/AbortController/AbortController

@lambdalisue
Copy link
Member

@prabirshrestha
Copy link
Author

@lambdalisue Would it be possible to get those merged in this repo?

@lambdalisue
Copy link
Member

Yes but not yet because vital.vim does not run tests on Neovim yet.

@prabirshrestha
Copy link
Author

I'm currently using callbag.vim and cancellation is now very easy with takeUntil. The following will start logging when the user enters insert mode and automatically stops logging when the user leaves the insert mode.

     call callbag#pipe(
        \ callbag#fromEvent('TextChangedI'),
        \ callbag#takeUntil(
        \   callbag#fromEvent('InsertLeave'),
        \ ),
        \ callbag#debounceTime(250),
        \ callbag#subscribe({
        \   'next': {x->s:log('next')},
        \   'error': {x->s:log('error')},
        \   'complete': {->s:log('complete')},
        \ }),
        \ )

Feel free to close the issue.

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