cm-chessboard 5.2.4 → 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.
|
@@ -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
|
@@ -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")
|