willb335 / chessboardjsx

:black_square_button: Chessboard built for React
https://chessboardjsx.com
MIT License
267 stars 79 forks source link

adding sound effect #70

Open moblizeit opened 3 years ago

moblizeit commented 3 years ago

is there a way to add sound when pieces are moved on the board?

willb335 commented 3 years ago

You could just check to see if the previous position is not equal to the current position. If so, add a sound effect and adjust the timing of it with setTimeout. You can use lodash's isEqual() to check if the two position objects are the same

moblizeit commented 3 years ago

sorry my question was actually how to add sound effects rather how to detect where to add it.