added debounce

This commit is contained in:
William Felker 2020-10-21 10:16:48 +08:00
parent 9d287efa19
commit f33ed06bed

View File

@ -222,11 +222,11 @@ export default class DataView extends React.Component {
window.removeEventListener("remote-data-deletion", this._handleDataDeletion);
window.removeEventListener("remote-slate-object-remove", this._handleRemoteSlateObjectRemove);
window.removeEventListener("remote-slate-object-add", this._handleRemoteSlateObjectAdd);
window.removeEventListener("scroll", this._handleScroll);
window.removeEventListener("scroll", this._handleCheckScroll);
window.removeEventListener("remote-update-carousel", this._handleUpdate);
}
_debounce = (func, wait) => {
_handleDebounce = (func, wait) => {
let timeout;
return function executedFunction(...args) {
@ -241,7 +241,6 @@ export default class DataView extends React.Component {
};
_handleScroll = (e) => {
var timer;
const windowHeight =
"innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight;
const body = document.body;
@ -259,6 +258,8 @@ export default class DataView extends React.Component {
}
};
_handleCheckScroll = this._handleDebounce(this._handleScroll, 250);
_handleCheckBox = (e) => {
let checked = this.state.checked;
if (e.target.value === false) {