-
Notifications
You must be signed in to change notification settings - Fork 46
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
#267 Add useScroll #278
base: main
Are you sure you want to change the base?
#267 Add useScroll #278
Conversation
}); | ||
|
||
useEffect(() => { | ||
if (element.current) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
скобки лишние
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
даже бахни так - if(!element.current) return и ниже что внутри скобок
@@ -0,0 +1,202 @@ | |||
import { type RefObject, useEffect, useRef, useState } from 'react'; | |||
|
|||
import { debounce as DebounceFn, throttle as ThrottleFn } from '@/utils/helpers'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
с маленькой буквы фанки
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
даже можешь заюзать так чтобы не было повторных неймов * as helpers from '@/utils/helpers'
и ниже helper.debounce() и тд
} | ||
}, throttle + idle); | ||
|
||
const onScrollHandler = useEvent((e: Event) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не e а event - буквы бесплатны
|
||
const onScrollEnd = DebounceFn((e: Event) => { | ||
const currentTime = Date.now(); | ||
if (currentTime - lastScrollTime.current >= idle) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут можно тоже предусмотреть чтобы сразу выйти типо if(currentTime - lastScrollTime.current < idle) return и ниже делать сеты
No description provided.