A reliable viewport tracking solution. While the built-in IntersectionObserver API offers similar functionality, its asynchronous nature makes it unsuitable for precise design and interaction scenarios.
PronotronIO uses a single flattened TypedArray to store and update the data of IO nodes.The package is not tied to scroll events; with every PronotronIO.handleScroll() request, it iterates over the table and processes only the possible events (scrolling-down: bottom-in, top-out; scrolling-up: bottom-out, top-in). And then it logically activates the corresponding listener states when a state change occurs.
Since the package is not coupled with scroll events, any scrolling logic (e.g., smooth scrolling) can be implemented.
Following demo executes scroll in RequestAnimationFrame and do not uses a throttle function which would utilized in the production. Performance can be tracked with stats.
Last recorded event:
Normalized Position: 0.00
Last recorded event: