+ runAutoplay: function() {
+ const infinitePlay = () => {
+ if (this.cursor == this.moves.length - 1) {
+ clearInterval(this.autoplayLoop);
+ this.autoplayLoop = null;
+ this.autoplay = false;
+ return;
+ }
+ if (this.inPlay || this.inMultimove)
+ // Wait next tick
+ return;
+ this.play();
+ };
+ if (this.autoplay) {
+ this.autoplay = false;
+ clearInterval(this.autoplayLoop);
+ this.autoplayLoop = null;
+ } else {
+ this.autoplay = true;
+ infinitePlay();
+ this.autoplayLoop = setInterval(infinitePlay, 1500);
+ }
+ },