cm-chessboard 5.2.4 → 5.2.6

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.
@@ -32,10 +32,11 @@ const chessboard = new Chessboard(document.getElementById("board"), {
32
32
 
33
33
  }]
34
34
  })
35
- chessboard.addArrow(ARROW_TYPE.default, "f3", "d5");
36
- chessboard.addArrow(ARROW_TYPE.default, "b8", "c6");
37
- chessboard.addArrow(ARROW_TYPE.pointy, "d2", "d3");
38
- chessboard.addArrow(ARROW_TYPE.danger, "g5", "e6");
35
+ chessboard.addArrow(ARROW_TYPE.default, "f3", "d5")
36
+ chessboard.addArrow(ARROW_TYPE.default, "b8", "c6")
37
+ chessboard.addArrow(ARROW_TYPE.pointy, "d2", "d3")
38
+ chessboard.addArrow(ARROW_TYPE.danger, "g5", "e6")
39
+ console.log(chessboard.getArrows())
39
40
  </pre>
40
41
  <h2>Methods</h2>
41
42
  <h3><code>addArrow(type, from, to)</code></h3>
@@ -72,6 +73,8 @@ chessboard.addArrow(ARROW_TYPE.danger, "g5", "e6");
72
73
  chessboard.addArrow(ARROW_TYPE.default, "b8", "c6")
73
74
  chessboard.addArrow(ARROW_TYPE.pointy, "d2", "d3")
74
75
  chessboard.addArrow(ARROW_TYPE.danger, "g5", "e6")
76
+ console.log(chessboard.getArrows())
77
+
75
78
  </script>
76
79
  </body>
77
80
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chessboard",
3
- "version": "5.2.4",
3
+ "version": "5.2.6",
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
  }
@@ -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")