-
-
Save marshallds/11ba0bed227d003e325e8a040a69c717 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Component extends React.Component { | |
onScroll(event) { | |
this.scrollPosition = getScrollPosition(event); | |
if (this.scrolling) return; | |
this.scrolling = true; | |
const processLongOperation = (beginPosition) => { | |
longOperation(beginPosition, (completionState) => { | |
this.setState(completionState, () => { | |
//rendered | |
if (this.scrollPosition === beginPosition) { | |
this.scrolling = false; | |
} else { | |
_.defer(processLongOperation, this.scrollPosition); | |
} | |
}); | |
}); | |
}; | |
processLongOperation(this.scrollPostion); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment