mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
I imagine blaze-component changed their Mixins API since I written this code. We need some tests to avoid this kind of regressions when updating dependencies! Fixes #420
32 lines
673 B
JavaScript
32 lines
673 B
JavaScript
const peakAnticipation = 200;
|
|
|
|
Mixins.InfiniteScrolling = BlazeComponent.extendComponent({
|
|
onCreated() {
|
|
this._nextPeak = Infinity;
|
|
},
|
|
|
|
setNextPeak(v) {
|
|
this._nextPeak = v;
|
|
},
|
|
|
|
getNextPeak() {
|
|
return this._nextPeak;
|
|
},
|
|
|
|
resetNextPeak() {
|
|
this._nextPeak = Infinity;
|
|
},
|
|
|
|
events() {
|
|
return [{
|
|
scroll(evt) {
|
|
const domElement = evt.currentTarget;
|
|
let altitude = domElement.scrollTop + domElement.offsetHeight;
|
|
altitude += peakAnticipation;
|
|
if (altitude >= this.callFirstWith(null, 'getNextPeak')) {
|
|
this.mixinParent().callFirstWith(null, 'reachNextPeak');
|
|
}
|
|
},
|
|
}];
|
|
},
|
|
});
|