Skip to content

Instantly share code, notes, and snippets.

@cazala
Created July 25, 2018 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cazala/ea259f185e5fef682a436b25f54b0716 to your computer and use it in GitHub Desktop.
Save cazala/ea259f185e5fef682a436b25f54b0716 to your computer and use it in GitHub Desktop.
} else if (elementId != null) {
// players can click squares only on their turn
if (whiteTurn && this.id !== playerWhite) return
if (!whiteTurn && this.id !== playerBlack) return
// click on square
const squareId = getSquareId(elementId)
const square = state.squares.find(
(square: any) => square.id === squareId
)
store.dispatch(squareClick(square.id, square.pieceId, square.color))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment