We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
防抖 (debounce): 将多次高频操作优化为只在最后一次执行,通常使用的场景是:用户输入,只需再输入完成后做一次输入校验即可。
// 将多高频次操作优化为最后一次执行, 优化性能 function debounc(fn, wait, immediate) { let timer = null; return function () { let args = arguments; let context = this; if (immediate && !timer) { fn.apply(context, args); } if (timer) clearTimeout(timer); timer = setTimeout(() => { fn.apply(context, args); }, wait); }; };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
防抖 (debounce): 将多次高频操作优化为只在最后一次执行,通常使用的场景是:用户输入,只需再输入完成后做一次输入校验即可。
The text was updated successfully, but these errors were encountered: