in js/index.js [104:132]
_hookUpViewport() {
this.viewport = this._initViewport();
if (this.virtualized) {
let blockUntil = 0;
const onViewportChange = () => {
if (performance.now() > blockUntil) {
this._scheduleRedraw();
} else if (!this._state.removed) {
// If the scroll events are blocked, we shouldn't just swallow them.
// Wait for 0.1 second and give another try.
window.setTimeout(onViewportChange, 100);
}
};
this.viewport.on('change', onViewportChange);
//
// On keypress, we want to block the scroll events for 0.2 second to wait
// for the animation to complete. Otherwise, the scroll would change the
// geometry metrics and break the animation. The worst thing we may get is,
// for 'HOME' and 'END' keys, the view doesn't scroll to the right position.
//
this.viewport.on('keypress', () => {
blockUntil = performance.now() + 200;
});
}
}