blob: 722774c48d230db5d8433a74fcb12dee963b681d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
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');
}
},
},
];
},
});
|