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
防抖,顾名思义,防止抖动,以免把一次事件误认为多次,敲键盘就是一个每天都会接触到的防抖操作。
防抖重在清零 clearTimeout(timer)
function debounce (f, wait) { let timer return (...args) => { clearTimeout(timer) timer = setTimeout(() => { f(...args) }, wait) } }
function myDebounce(listener, delay, handler) { var timer = null; return function () { var ctx = handler || this; var args = arguments; clearTimeout(timer); timer = setTimeout(function () { listener.apply(ctx, args); }, delay); }; } exports. myDebounce = myDebounce;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
防抖
防抖,顾名思义,防止抖动,以免把一次事件误认为多次,敲键盘就是一个每天都会接触到的防抖操作。
防抖的使用场景
重点概念
防抖重在清零 clearTimeout(timer)
写法
es6写法
es5写法
节流
The text was updated successfully, but these errors were encountered: