Add debounce/throttle test for calling cancel and flush without anything queued.

This commit is contained in:
John-David Dalton
2016-03-24 00:35:22 -07:00
parent 577226bbd0
commit 016de80ce7
2 changed files with 24 additions and 6 deletions

View File

@@ -9137,10 +9137,9 @@
}
function trailingEdge(time) {
if (timerId !== undefined) {
clearTimeout(timerId);
timerId = undefined;
}
clearTimeout(timerId);
timerId = undefined;
// Only invoke if we have `lastArgs` which means `func` has been
// debounced at least once.
if (trailing && lastArgs) {