Skip to content
New issue

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

javascript问题里函数节流的实现有误~ #6

Open
webfansplz opened this issue Nov 22, 2018 · 1 comment
Open

javascript问题里函数节流的实现有误~ #6

webfansplz opened this issue Nov 22, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@webfansplz
Copy link

function throttle(method, context) {
     clearTimeout(methor.tId);
     method.tId = setTimeout(function(){
         method.call(context);
     } 100); // 两次调用至少间隔 100ms
}
// 调用
window.onresize = function(){
    throttle(myFunc, window);
}

这段代码的实现应该是函数防抖哦!!!

@nanhupatar
Copy link
Member

emm,确实是。高程里面弄错了

@nanhupatar nanhupatar added the bug Something isn't working label Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants