vital.vim
vital.vim copied to clipboard
add support for CancellationTokenSource and CancellationToken
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
Here you are. https://github.com/lambdalisue/vital-Whisky/tree/master/autoload/vital/vital/Async
@lambdalisue Would it be possible to get those merged in this repo?
Yes but not yet because vital.vim does not run tests on Neovim yet.
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.