drop Trash
If 'trash' is passed to the drop event's setAction() function, the dragged piece will be removed.
HTML
<chess-board
style="width: 400px"
position="start"
draggable-pieces>
</chess-board>
JavaScript
const board = document.querySelector('chess-board');
// trash black pieces when they are dropped
board.addEventListener('drop', (e) => {
const {piece, setAction} = e.detail;
if (piece.search(/b/) !== -1) {
setAction('trash');
}
});