mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Replace the old (and broken) jshint + jscsrc by eslint and configure it to support some of the ES6 features. The command `eslint` currently has one error which is a bug that was discovered by its static analysis and should be fixed (usage of a dead object).
37 lines
736 B
JavaScript
37 lines
736 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;
|
|
},
|
|
|
|
// To be overwritten by consumers of this mixin
|
|
reachNextPeak() {
|
|
|
|
},
|
|
|
|
events() {
|
|
return [{
|
|
scroll(evt) {
|
|
const domElement = evt.currentTarget;
|
|
let altitude = domElement.scrollTop + domElement.offsetHeight;
|
|
altitude += peakAnticipation;
|
|
if (altitude >= this.callFirstWith(null, 'getNextPeak')) {
|
|
this.callFirstWith(null, 'reachNextPeak');
|
|
}
|
|
},
|
|
}];
|
|
},
|
|
});
|