From c9492d79a102447743c9872afe5e95912d43e821 Mon Sep 17 00:00:00 2001 From: Brad Buchanan Date: Mon, 25 Jul 2016 13:31:13 -0700 Subject: [PATCH] Document behavior of _.debounce when wait is 0 (#2530) Clarify that when `leading` is false a debounced method with `wait=0` will not invoke immediately, but on the next tick (like `setTimeout`), but when `leading` is true the invocation will be immediate. --- lodash.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lodash.js b/lodash.js index bd0d02c67..e363c0656 100644 --- a/lodash.js +++ b/lodash.js @@ -9793,6 +9793,11 @@ * on the trailing edge of the timeout only if the debounced function is * invoked more than once during the `wait` timeout. * + * If `leading` is false `func` will not be invoked immediately, even if + * `wait` is `0`. It will be queued to run on the next tick, similar to + * how `setTimeout` behaves with a timeout of `0`. If `leading` is true, + * `func` can be invoked immediately. + * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.debounce` and `_.throttle`. *