src/games/snakeGame/level1/snakeGamelevel1.js
//do some clean up when component destroyed
do some clean up when component destroyed
do some clean up when component destroyed
componentWillUnmount(){
    document.removeEventListener('keydown',e=>this.logic.direction(e))
    this.fun =  document.addEventListener('touchstart',e=> this.logic.handleTouch(e),false);
    this.fun =  document.addEventListener('touchmove',e=> this.logic.gestureHandler(e),false);
    document.body.style.touchAction="initial"
  }
componentWillUnmount ( ) { document . removeEventListener ( 'keydown' , e => this . logic . direction ( e ) ) this . fun = document . addEventListener ( 'touchstart' , e => this . logic . handleTouch ( e ) , false ) ; this . fun = document . addEventListener ( 'touchmove' , e => this . logic . gestureHandler ( e ) , false ) ; document . body . style . touchAction = "initial" }
do some clean up when component destroyed
do some clean up when component destroyed