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

[bug]: debounce реализован с небольшим багом #230

Closed
loonlylokly opened this issue Aug 26, 2024 · 1 comment · Fixed by #238
Closed

[bug]: debounce реализован с небольшим багом #230

loonlylokly opened this issue Aug 26, 2024 · 1 comment · Fixed by #238

Comments

@loonlylokly
Copy link

При использовании такого варианта реализации debounce теряется контекст, когда нужно использовать его с обработчиком событий. Вот пример: https://codepen.io/lonlylokly/pen/jOjKMXb (там нужно одну строку раскомментировать в js, а другую закомментировать и в консоле выведиться не input, а window . Я его взял из doka.guide , так как я сейчас исправляю там debounce doka-guide/content#5493 ). Возможно он теряется ещё в каких-то ситуациях, но я не проверял.

Короче нужно контекст привязывать в функции которую передаем в setTimeout, или использовать function

@loonlylokly loonlylokly changed the title [bug]: debounce реализован с небольшой небольшим нюансом [bug]: debounce реализован с небольшим багом Aug 26, 2024
@debabin debabin linked a pull request Sep 3, 2024 that will close this issue
@debabin
Copy link
Member

debabin commented Sep 3, 2024

#238 @loonlylokly

debabin added a commit that referenced this issue Sep 4, 2024
#230 🧊 add this for throttle and debounce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@loonlylokly @debabin and others