Last active
April 9, 2018 08:10
-
-
Save dbismut/4ff1ac6acc44bbb8705917d29b2f097a to your computer and use it in GitHub Desktop.
Part 3 - Adding listeners for touch events
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
addListeners = () => { | |
window.addEventListener('scroll', this.onScroll); | |
window.addEventListener('touchstart', this.onTouchStart); | |
window.addEventListener('touchend', this.onTouchEnd); | |
}; | |
removeListeners = () => { | |
window.removeEventListener('scroll', this.onScroll); | |
window.removeEventListener('touchend', this.onTouchEnd); | |
window.removeEventListener('touchstart', this.onTouchStart); | |
}; | |
onTouchStart = () => (this.isTouching = true); | |
onTouchEnd = () => (this.isTouching = false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment