cm-chessboard 5.2.3 → 5.2.5

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.
package/README.md CHANGED
@@ -344,11 +344,12 @@ Currently possible extension points are defined in `Extension.js`.
344
344
 
345
345
  ```js
346
346
  export const EXTENSION_POINT = {
347
- positionChanged: "positionChanged", // the positions of the pieces was changed
348
- boardChanged: "boardChanged", // the board (orientation) was changed
349
- moveInputToggled: "moveInputToggled", // move input was enabled or disabled
350
- moveInput: "moveInput", // move started, canceled or validation // TODO validation in extensions is not awailable for now
351
- destroy: "destroy" // called, before the board is destroyed
347
+ positionChanged: "positionChanged", // the positions of the pieces was changed
348
+ boardChanged: "boardChanged", // the board (orientation) was changed
349
+ moveInputToggled: "moveInputToggled", // move input was enabled or disabled
350
+ moveInput: "moveInput", // move started, to validate or canceled // TODO validation not possible for now, see https://github.com/shaack/cm-chessboard/issues/82
351
+ redrawBoard: "redrawBoard", // called after redrawing the board
352
+ destroy: "destroy" // called, before the board is destroyed
352
353
  }
353
354
  ```
354
355
 
@@ -72,6 +72,8 @@ chessboard.addArrow(ARROW_TYPE.danger, "g5", "e6");
72
72
  chessboard.addArrow(ARROW_TYPE.default, "b8", "c6")
73
73
  chessboard.addArrow(ARROW_TYPE.pointy, "d2", "d3")
74
74
  chessboard.addArrow(ARROW_TYPE.danger, "g5", "e6")
75
+ console.log(chessboard.getArrows())
76
+
75
77
  </script>
76
78
  </body>
77
79
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chessboard",
3
- "version": "5.2.3",
3
+ "version": "5.2.5",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",
@@ -98,19 +98,11 @@ export class Arrows extends Extension {
98
98
  }
99
99
 
100
100
  addArrow(type, from, to) {
101
- if (typeof type === "string" || typeof from === "object" || typeof to === "object") { // todo remove 2022-12-01
102
- console.error("changed the signature of `addArrow` to `(type, from, to)` with v5.1.x")
103
- return
104
- }
105
101
  this.arrows.push(new Arrow(from, to, type))
106
102
  this.chessboard.view.redrawBoard()
107
103
  }
108
104
 
109
105
  getArrows(type = undefined, from = undefined, to = undefined) {
110
- if (typeof type === "string" || typeof from === "object" || typeof to === "object") { // todo remove 2022-12-01
111
- console.error("changed the signature of `getArrows` to `(type, from, to)` with v5.1.x")
112
- return
113
- }
114
106
  let arrows = []
115
107
  this.arrows.forEach((arrow) => {
116
108
  if (arrow.matches(from, to, type)) {
@@ -121,10 +113,6 @@ export class Arrows extends Extension {
121
113
  }
122
114
 
123
115
  removeArrows(type = undefined, from = undefined, to = undefined) {
124
- if (typeof type === "string" || typeof from === "object" || typeof to === "object") { // todo remove 2022-12-01
125
- console.error("changed the signature of `removeArrows` to `(type, from, to)` with v5.1.x")
126
- return
127
- }
128
116
  this.arrows = this.arrows.filter((arrow) => !arrow.matches(from, to, type))
129
117
  this.chessboard.view.redrawBoard()
130
118
  }
@@ -10,8 +10,8 @@ export const EXTENSION_POINT = {
10
10
  moveInputToggled: "moveInputToggled", // move input was enabled or disabled
11
11
  moveInput: "moveInput", // move started, to validate or canceled // TODO validation not possible for now, see https://github.com/shaack/cm-chessboard/issues/82
12
12
  moveInputStateChanged: "moveInput", // TODO deprecated, use `moveInput`
13
- destroy: "destroy", // called, before the board is destroyed
14
- redrawBoard: "redrawBoard" // called while redrawing the board
13
+ redrawBoard: "redrawBoard", // called after redrawing the board
14
+ destroy: "destroy" // called, before the board is destroyed
15
15
  }
16
16
 
17
17
  export class Extension {
@@ -31,7 +31,7 @@ export class Extension {
31
31
  registerMethod(name, callback) {
32
32
  if (!this.chessboard[name]) {
33
33
  this.chessboard[name] = (...args) => {
34
- callback.apply(this, args)
34
+ return callback.apply(this, args)
35
35
  }
36
36
  } else {
37
37
  log.error("method", name, "already exists")