Description
I have a scrollEventHandler which is debouncing the scroll events so that I can create a scrollEnd-like feature:
scrollable-view.hbs
scrollable-view.js
export default Component.extend({
layout,
tagName: '',
actions: {
scrollEnd(callback) {
if (callback && typeof callback === 'function') {
debounce(this, () => callback, 100, false);
}
},
},
});
This all works fine in the app. However, when I attempt to test this feature and make use of the scrollTo
helper, each scroll event forces the debounce to wait for it's timeout to expire and trigger (effectively nullifying the purpose of the debounce).
It seems that this is caused by the use of wait
in the helper: https://github.com/cibernox/ember-native-dom-helpers/blob/master/addon-test-support/scroll-to.js#L16
Now, my question is whether it's possible for the helper to wait for the scroll event to occur in the browser without having to wait()
for ember runloop (which is what seems to cause the debounce)?