Skip to content

feat: Adds an observer component

Sam Beckham requested to merge observer-component into master

This component uses the intersection observer to give us acces to two events. One that fires when the component becomes visible on the screen, and another that fires as soon as it leaves the screen.

It's based on the component used in this blog post but I've re-jigged it to match our style guide and added a disappear event to it too.

This is similar to Bootstrap Vue's visible directive, but it a bit more useful IMO.

It's a pretty simple component that can have a lot of uses, and can really boost performance if used correctly. I've added a video walkthrough

On a side note: I have no earthly idea how I would test this component

Edited by Sam Beckham

Merge request reports