hotfix throttle function args

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent ee5554c890
commit 21e90a0c7d
3 changed files with 4 additions and 3 deletions

View File

@@ -53,13 +53,14 @@ export function throttle<T>(
let timeout: number | null = null;
let previous = 0;
// tslint:disable-next-line: only-arrow-functions
return function(args: T) {
return function(arg: T) {
let now = Date.now();
if (!previous && options.leading === false) {
previous = now;
}
let remaining = wait - (now - previous);
let context = this;
let args = arguments;
if (remaining <= 0 || remaining > wait) {
if (timeout) {
window.clearTimeout(timeout);