mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-11 17:10:36 +03:00
Rename custom event
I was googeling for ages to find out what kind of event `inview` is, only to figure out it was a custom event with a name that sounds pretty much like a native one. 🫠
This commit is contained in:
parent
d6c9a07faa
commit
74e8249ca8
|
@ -13,7 +13,7 @@ export default function Section({ id, className, ...props }) {
|
|||
|
||||
useEffect(() => {
|
||||
if (inView && relId) {
|
||||
window.dispatchEvent(new CustomEvent('inview', { detail: relId }))
|
||||
window.dispatchEvent(new CustomEvent('SPACY_SCROLL_HANDLER', { detail: relId }))
|
||||
}
|
||||
}, [inView, relId])
|
||||
return <section ref={ref} id={id} className={sectionClassNames} {...props} />
|
||||
|
|
|
@ -44,9 +44,9 @@ export default function Sidebar({ items = [], pageMenu = [], slug }) {
|
|||
|
||||
useEffect(() => {
|
||||
const handleInView = ({ detail }) => setActiveSection(detail)
|
||||
window.addEventListener('inview', handleInView, { passive: true })
|
||||
window.addEventListener('SPACY_SCROLL_HANDLER', handleInView, { passive: true })
|
||||
return () => {
|
||||
window.removeEventListener('inview', handleInView)
|
||||
window.removeEventListener('SPACY_SCROLL_HANDLER', handleInView)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user