DockYard / ember-in-viewport

Detect if an Ember View or Component is in the viewport @ 60FPS
MIT License
245 stars 91 forks source link

Passing intersection observer entry along to modifier callbacks #260

Closed gmurphey closed 3 years ago

gmurphey commented 4 years ago

I have a case where it would be beneficial to have the intersection observer entry in my in-viewport modifier callbacks.

@action
entered(_, entry) {
    const targetInfo = entry.boundingClientRect;
    const rootBoundsInfo = entry.rootBounds;

    if (targetInfo.bottom < rootBoundsInfo.top) {
      // do some things
    }
}
<div {{in-viewport onEnter=this.entered}}></div>
cibernox commented 3 years ago

It turns out I did this very same thing on #278 and I didn't notice there was an open PR for this very same thing. This can be closed now.

cibernox commented 3 years ago

FYI it has been released already.