diff --git a/README.md b/README.md index c0e4315bb..b2751beb3 100644 --- a/README.md +++ b/README.md @@ -5099,7 +5099,7 @@ const throttle = (fn, wait) => { fn.apply(context, args); lastTime = Date.now(); } - }, wait - (Date.now() - lastTime)); + }, Math.max(wait - (Date.now() - lastTime), 0)); } }; }; diff --git a/docs/function.html b/docs/function.html index 80d666910..9d4d4c6a9 100644 --- a/docs/function.html +++ b/docs/function.html @@ -269,7 +269,7 @@ document.body.apply(context, args); lastTime = Date.now(); } - }, wait - (Date.now() - lastTime)); + }, Math.max(wait - (Date.now() - lastTime), 0)); } }; };