You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
При использовании такого варианта реализации debounce теряется контекст, когда нужно использовать его с обработчиком событий. Вот пример: https://codepen.io/lonlylokly/pen/jOjKMXb (там нужно одну строку раскомментировать в js, а другую закомментировать и в консоле выведиться не input, а window . Я его взял из doka.guide , так как я сейчас исправляю там debounce doka-guide/content#5493 ). Возможно он теряется ещё в каких-то ситуациях, но я не проверял.
Короче нужно контекст привязывать в функции которую передаем в setTimeout, или использовать function
The text was updated successfully, but these errors were encountered:
loonlylokly
changed the title
[bug]: debounce реализован с небольшой небольшим нюансом
[bug]: debounce реализован с небольшим багом
Aug 26, 2024
При использовании такого варианта реализации debounce теряется контекст, когда нужно использовать его с обработчиком событий. Вот пример: https://codepen.io/lonlylokly/pen/jOjKMXb (там нужно одну строку раскомментировать в js, а другую закомментировать и в консоле выведиться не input, а window . Я его взял из doka.guide , так как я сейчас исправляю там debounce doka-guide/content#5493 ). Возможно он теряется ещё в каких-то ситуациях, но я не проверял.
Короче нужно контекст привязывать в функции которую передаем в setTimeout, или использовать function
The text was updated successfully, but these errors were encountered: