cm-chessboard

Example: Input enabled without validation

Input enabled on both sides, without move validation.

const board = new Chessboard(document.getElementById("board"), {
    position: "start",
    moveInputMode: MOVE_INPUT_MODE.dragPiece,
    sprite: {url: "../assets/images/chessboard-sprite.svg"}
})

board.enableMoveInput(inputHandler)
function inputHandler(event) {
    switch (event.type) {
        case INPUT_EVENT_TYPE.moveStart:
            log(`moveStart: ${event.square}`)
            return true
        case INPUT_EVENT_TYPE.moveDone:
            log(`moveDone: ${event.squareFrom}-${event.squareTo}`)
            return true
        case INPUT_EVENT_TYPE.moveCanceled:
            log(`moveCanceled`)
    }
}