mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-14 10:30:34 +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(() => {
|
useEffect(() => {
|
||||||
if (inView && relId) {
|
if (inView && relId) {
|
||||||
window.dispatchEvent(new CustomEvent('inview', { detail: relId }))
|
window.dispatchEvent(new CustomEvent('SPACY_SCROLL_HANDLER', { detail: relId }))
|
||||||
}
|
}
|
||||||
}, [inView, relId])
|
}, [inView, relId])
|
||||||
return <section ref={ref} id={id} className={sectionClassNames} {...props} />
|
return <section ref={ref} id={id} className={sectionClassNames} {...props} />
|
||||||
|
|
|
@ -44,9 +44,9 @@ export default function Sidebar({ items = [], pageMenu = [], slug }) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleInView = ({ detail }) => setActiveSection(detail)
|
const handleInView = ({ detail }) => setActiveSection(detail)
|
||||||
window.addEventListener('inview', handleInView, { passive: true })
|
window.addEventListener('SPACY_SCROLL_HANDLER', handleInView, { passive: true })
|
||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener('inview', handleInView)
|
window.removeEventListener('SPACY_SCROLL_HANDLER', handleInView)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user