Using debounce function in underscore

2019-07-04 09:26发布

问题:

I use underscore.js to run task.

_.debounce(task, 100)

How stop executing _.debounce?

回答1:

_.debounce does not execute anything, so you cannot stop it. It returns a new function which takes care of the debouncing.

If you don't want to use it anymore, just use the original function.

Have a look at the documentation for more information.



回答2:

I assume you want to slow down an expensive task, i've written a post here to explain the _.debounce() method behaviour.

Cheers

PS....archived post