Skip to content

Commit

Permalink
Finish #32
Browse files Browse the repository at this point in the history
Closes #29
  • Loading branch information
sindresorhus committed Nov 15, 2023
1 parent c997759 commit 2b78c0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ function debounce(func, wait, immediate){

debounced.flush = function() {
if (timeout) {
result = func.apply(context, args);
var callContext = context, callArgs = args;
context = args = null;
result = func.apply(callContext, callArgs);

clearTimeout(timeout);
timeout = null;
Expand Down

0 comments on commit 2b78c0d

Please sign in to comment.