Skip to content

Instantly share code, notes, and snippets.

@Samsy
Created March 7, 2016 11:16
Show Gist options
  • Save Samsy/b2dc24b1f8694540721f to your computer and use it in GitHub Desktop.
Save Samsy/b2dc24b1f8694540721f to your computer and use it in GitHub Desktop.
addevents
addTouchEvent() {
console.log('readd')
this.wrapper = document.querySelector('.wrapper')
let bla = ["touchstart", "touchend", "touchmove"]
bla.forEach( (func)=> {
this[func + 'event'] = this[func].bind(this)
this.wrapper.addEventListener(func, this[func + 'event'] )
} )
}
removeTouchEvents() {
let bla = ["touchstart", "touchend", "touchmove"]
bla.forEach( (func)=> {
this.wrapper.removeEventListener(func, this[func + 'event'] )
} )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment