Skip to content

Commit

Permalink
Fixed a few more details
Browse files Browse the repository at this point in the history
  • Loading branch information
kritollm committed Dec 7, 2020
1 parent 913bcf2 commit 0b93f06
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
7 changes: 3 additions & 4 deletions modules/debounce.js
Expand Up @@ -10,13 +10,12 @@ export default function debounce(func, wait, immediate) {

var later = function() {
var passed = now() - previous;
if (wait >= passed) {
if (wait > passed) {
timeout = setTimeout(later, wait - passed);

} else {
timeout = null;
if (!immediate) result = func.apply(context, args);
// This check is needed because the argument function can recursively invoke debounced
// This check is needed because the func can recursively invoke debounced
if (!timeout) args = context = null;
}
};
Expand All @@ -38,4 +37,4 @@ export default function debounce(func, wait, immediate) {
};

return debounced;
}
}
2 changes: 1 addition & 1 deletion modules/throttle.js
Expand Up @@ -44,4 +44,4 @@ export default function throttle(func, wait, options) {
};

return throttled;
}
}
5 changes: 2 additions & 3 deletions underscore-esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion underscore-esm.js.map

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions underscore.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion underscore.js.map

Large diffs are not rendered by default.

0 comments on commit 0b93f06

Please sign in to comment.