This commit is contained in:
Maciej Caderek
2022-02-11 22:22:12 +01:00
parent d08080543d
commit db40aa2939
6 changed files with 51 additions and 7 deletions

View File

@@ -112,8 +112,21 @@ const main = async () => {
changePiecesStyle(style: PiecesStyle) {
board.setPiecesStyle(style);
},
async loadPGN(pgn: string) {
const game = new Game().loadPGN(pgn);
setState({ pgn, fen: null, moves: game.getMoves() });
await player.load(game);
},
async loadFEN(fen: string) {
const game = new Game().loadFEN(fen);
setState({ pgn: null, fen, moves: game.getMoves() });
await player.load(game);
},
};
// @ts-ignore
window.handlers = handlers;
/**
* RENDER
**/