Closed p closed 7 years ago
It sounds counter-intuitive to me. I think force
should always call the function, even if there's no timeout going on.
It may be helpful to think of force
as a flush
method on a file. Both are called from different contexts than debounce
itself/write
. The code that does force/flush does not have arguments for the debounce/write call.
Maybe a different name would be more appropriate, open to suggestions.
I'm inclined to call it reset
.
I don't think one would expect reset
to perform an action...
How about flush
?
Go for it
Thanks!
This feature was added 4 months ago, any plans to publish to npm?
@vendethiel Could you publish this feature?
@mysticatea I don't have npm access to this package...
@vendethiel do you know who does, or when a release is planned?
I don't know
@stephenmathieson Are you able to publish a new version on npm with this PR included?
Yep! I can publish in the morning
1.1.0
This PR adds an option to force execution of any scheduled invocations.
Use case: I have a map that the user can move around, and the center is updated on the server with each move. This update is debounced. The user can also load a different object into the map in which case I want to immediately flush pending moves for the old object.