-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to 3.0 and remove jquery usage #121
Conversation
viewportOptionsOverride: Ember.on('didInsertElement', function() { | ||
init() { | ||
this._super(...arguments); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on eslint's rule no-function-prototype-extensions
$(context).off(`scroll.directional#${elementId}`); | ||
elem.removeEventListener('scroll', () => { | ||
this._debouncedEventHandler('_triggerDidScrollDirection', elem, get(this, 'viewportScrollSensitivity')); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not totally sure of the implications of this. It wouldn't be good if the removeEventListener matching algorithm didn't match....so maybe I should put the callback as a method on the mixin instead of repeating it in the addEventListener callback.
addon/mixins/in-viewport.js
Outdated
|
||
$contextEl.on(`scroll.directional#${get(this, 'elementId')}`, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also concerned about the use of elementId
here. Perhaps this was there to solve a use case where this mixin was used on many components on a page. So potentially, with this PR, there are multiple listeners on the window object.
I'm getting |
@bkoval What do you have set for the Note: one thing I did notice is that we aren't allowing users to specify https://github.com/DockYard/ember-in-viewport/blob/master/addon/mixins/in-viewport.js#L104 |
@snewcomer I am just setting top and bottom. Could it be that on master ember-in-viewport uses defaults in such case? |
@bkoval would you mind pasting your |
Sure:
|
@bkoval Welp, you are completely correct. Sry about that. Put a PR in to fix. In the meantime, if your config looked like this, it should work. Thanks for reporting this bug!
|
fff4785
to
7afa74f
Compare
Tested this branch out on our app and works 👍 . Anybody else wanna give it a go? |
Still got some work to do here. Previous implementation for scroll listeners did something to the effect of
scroll.elementId
whereas now it just simply listens forscroll
. Need to look into if this could break anything.Closes #118