Joffrey Thomas commited on
Commit
6139d24
·
1 Parent(s): e83ab43

chess change

Browse files
Files changed (1) hide show
  1. chess_game/static/room.js +6 -1
chess_game/static/room.js CHANGED
@@ -58,8 +58,13 @@
58
  }
59
 
60
  async function init() {
 
 
 
 
61
  chess = new Chess();
62
- board = Chessboard(boardEl, {
 
63
  position: 'start', draggable: true, dropOffBoard: 'snapback',
64
  onDragStart, onDrop, onSnapEnd
65
  });
 
58
  }
59
 
60
  async function init() {
61
+ if (typeof Chess === 'undefined' || typeof Chessboard === 'undefined') {
62
+ console.error('Required libraries not loaded: Chess and/or Chessboard');
63
+ return;
64
+ }
65
  chess = new Chess();
66
+ // chessboard.js prefers element id string in many setups
67
+ board = Chessboard('boardUI', {
68
  position: 'start', draggable: true, dropOffBoard: 'snapback',
69
  onDragStart, onDrop, onSnapEnd
70
  });