Skip to content

Instantly share code, notes, and snippets.

@antonycourtney
Created October 15, 2015 06:32
Show Gist options
  • Save antonycourtney/7af6b62220f747b42fc0 to your computer and use it in GitHub Desktop.
Save antonycourtney/7af6b62220f747b42fc0 to your computer and use it in GitHub Desktop.
scroll action in oneref-flux-challenge
export function scroll(scrollAmount,updater) {
updater((prevState) => {
const {nextState, oldRequests} = prevState.scrollAdjust(scrollAmount);
oldRequests.forEach((req) => req.abort()); // cancel old requests
// Need invokeLater since we're within updater
invokeLater(() => fillView(nextState,updater));
return nextState;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment