()
| 102 | return undefined; |
| 103 | } |
| 104 | const callback = () => { |
| 105 | setIsCompact( |
| 106 | document.documentElement.scrollTop >= window.innerHeight / 2, |
| 107 | ); |
| 108 | }; |
| 109 | callback(); |
| 110 | window.addEventListener('scroll', callback, { passive: true }); |
| 111 | return () => window.removeEventListener('scroll', callback); |
no outgoing calls