Closed DougPuchalski closed 10 years ago
interesting, wanna try a PR im curious
Certainly can (if I can get testem to work). I'm still trying to decide whether this makes sense to add to debounce or if it might be a another utility.
Given: the debounce function, which has a target function that's called after the timer event. Pending state of the target function would be tracked until it returns, or its promise resolves. While pending, if the debounce function is called again, it would call the onCancel hook and then reset the timer.
Effectively, it's like debouncing not only for the timer delay, but also for the time to resolve the request.
I'm trying to decide whether this belongs in debounce, another method, or at the app-level.
Thoughts?
@aceofspades my first thought is a higher level abstraction thats app specific
Im closing this issue, but we can continue the discussion.
I think I agree this doesn't belong with debounce, and easily done at the app level. Feels like there is a lower-level abstraction here for handling slow async requests such as ajax but not quite sure where it belongs.
Would it make sense to allow debounce to trigger a hook on cancelled callbacks so that the app could, for example, abort ajax requests?