drag-move

The drag-move event fires every time a piece changes location.

HTML

<chess-board
    style="width: 400px"
    position="start"
    draggable-pieces
    spare-pieces>
</chess-board>

JavaScript

const board = document.querySelector('chess-board');

board.addEventListener('drag-move', (e) => {
  const {newLocation, oldLocation, source,
                     piece, position, orientation} = e.detail;
  console.log('New location: ' + newLocation)
  console.log('Old location: ' + oldLocation)
  console.log('Source: ' + source)
  console.log('Piece: ' + piece)
  console.log('Position: ' + objToFen(position))
  console.log('Orientation: ' + orientation)
  console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
});