Skip to content

Commit

Permalink
fix invocation with { noLeading: true, noTrailing: true }
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyab authored and niksy committed Apr 15, 2022
1 parent 8dc4909 commit 1f0feb5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion throttle.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ export default function (delay, callback, options) {
* to execute after `delay` ms.
*/
lastExec = Date.now();
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
if (!noTrailing) {
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
}
} else {
/*
* In throttle mode without noLeading, if `delay` time has been exceeded, execute
Expand Down

0 comments on commit 1f0feb5

Please sign in to comment.