cm-chessboard 5.5.8 → 5.5.9

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.
@@ -34,9 +34,10 @@
34
34
  setTimeout(() => {
35
35
  chessboard.movePiece("e7", "e5", true).then(() => {
36
36
  setTimeout(() => {
37
- const url = chessboard.recorderStop()
38
- const video = document.getElementById("videoOut")
39
- video.src = url
37
+ chessboard.recorderStop().then((url) => {
38
+ const video = document.getElementById("videoOut")
39
+ video.src = url
40
+ })
40
41
  }, 100)
41
42
  })
42
43
  }, 400)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chessboard",
3
- "version": "5.5.8",
3
+ "version": "5.5.9",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",
@@ -25,7 +25,7 @@ export class RenderVideo extends Extension {
25
25
  }
26
26
  })
27
27
  this.registerMethod("recorderStart", () => {
28
- if(this.recorder && this.recorder.state === "recording") {
28
+ if (this.recorder && this.recorder.state === "recording") {
29
29
  console.error("recorder is running")
30
30
  return
31
31
  }
@@ -58,14 +58,17 @@ export class RenderVideo extends Extension {
58
58
  * returns the url of the recorded media
59
59
  */
60
60
  this.registerMethod("recorderStop", () => {
61
- if(!this.recorder || this.recorder.state !== "recording") {
62
- console.error("recorder is not recording")
63
- return
64
- }
65
- this.recorder.requestData()
66
- this.recorder.stop()
67
- console.log("recorder", this.recorder.state)
68
- return URL.createObjectURL(new Blob(this.recordedData, {type: this.props.mediaType}))
61
+ return new Promise((resolve, reject) => {
62
+ if (!this.recorder || this.recorder.state !== "recording") {
63
+ reject("recorder is not recording")
64
+ }
65
+ this.recorder.requestData()
66
+ setTimeout(() => {
67
+ this.recorder.stop()
68
+ console.log("recorder", this.recorder.state)
69
+ resolve(URL.createObjectURL(new Blob(this.recordedData, {type: this.props.mediaType})))
70
+ }, 100)
71
+ })
69
72
  })
70
73
  }
71
74