cm-chessboard 3.16.0 → 3.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,11 +21,20 @@
21
21
  <button onclick="switchOrientation()">Switch Orientation</button>
22
22
  <pre>&lt;button onclick="window.board.setPosition('rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR')"&gt;Position 3&lt;/button&gt;</pre>
23
23
  <br/>
24
- Move piece from: <input id="moveFrom" type="text" size="2" value="e2"/> to: <input id="moveTo" type="text" size="2" value="e4"/>
24
+ Move piece from: <input id="moveFrom" type="text" size="2" value="e2"/> to: <input id="moveTo" type="text" size="2"
25
+ value="e4"/>
25
26
  <button onclick="movePiece()">Do move</button>
26
27
  <pre>board.movePiece(squareFrom, squareTo)</pre>
28
+ <br/>
29
+ <button onclick="knightMove()">Knight dance</button>
30
+ <pre>
31
+ board.setPiece("e4", PIECE.wn)
32
+ await board.movePiece("e4", "c3")
33
+ await board.movePiece("c3", "d5")
34
+ await board.movePiece("d5", "f4")
35
+ </pre>
27
36
  <script type="module">
28
- import {Chessboard} from "../src/cm-chessboard/Chessboard.js"
37
+ import {Chessboard, PIECE} from "../src/cm-chessboard/Chessboard.js"
29
38
 
30
39
  const board = new Chessboard(document.getElementById("board"),
31
40
  {
@@ -49,6 +58,13 @@ Move piece from: <input id="moveFrom" type="text" size="2" value="e2"/> to: <in
49
58
  console.log("movePiece", squareFrom, squareTo)
50
59
  board.movePiece(squareFrom, squareTo)
51
60
  }
61
+ window.knightMove = async () => {
62
+ await board.setPosition("empty")
63
+ board.setPiece("e4", PIECE.wn)
64
+ await board.movePiece("e4", "c3")
65
+ await board.movePiece("c3", "d5")
66
+ await board.movePiece("d5", "f4")
67
+ }
52
68
  </script>
53
69
  </body>
54
70
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chessboard",
3
- "version": "3.16.0",
3
+ "version": "3.16.1",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",