Merge pull request #2545 from LLyaudet/patch-6

avoid race condition in 06-advanced-functions/09-call-apply-decorator…
This commit is contained in:
Ilya Kantor 2021-03-26 08:14:18 +03:00 committed by GitHub
commit 3b3f7c7eda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,11 +12,10 @@ function throttle(func, ms) {
savedThis = this;
return;
}
isThrottled = true;
func.apply(this, arguments); // (1)
isThrottled = true;
setTimeout(function() {
isThrottled = false; // (3)
if (savedArgs) {