Skip to content

Commit

Permalink
Merge pull request #362 from ChenKun1997/patch-2
Browse files Browse the repository at this point in the history
The debounce function does not work if 'immediate' is true
  • Loading branch information
ODudek authored Jun 15, 2023
2 parents 8093b3e + da397f7 commit c0ed88d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1910,11 +1910,11 @@ Create a new function that calls _func_ with _thisArg_ and _args_.
return function() {
var context = this, args = arguments;
clearTimeout(timeout);
if (immediate && !timeout) func.apply(context, args);
timeout = setTimeout(function() {
timeout = null;
if (!immediate) func.apply(context, args);
}, wait);
if (immediate && !timeout) func.apply(context, args);
};
}

Expand Down

0 comments on commit c0ed88d

Please sign in to comment.