Skip to content

Commit 1917a88

Browse files
committed
playbutton clears interval and changes dom
1 parent 65c77be commit 1917a88

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/app/containers/MainContainer.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,15 @@ class MainContainer extends Component {
6363
}
6464

6565
playForward(){
66-
setInterval(()=>{
66+
var play = setInterval(()=>{
6767
const { snapshots, snapshotIndex } = this.state;
6868
if(snapshotIndex<snapshots.length-1){
6969
const newIndex = snapshotIndex+1;
7070
this.handleJumpSnapshot(newIndex);
7171
this.setState({ snapshotIndex: newIndex });
72-
} else return;
72+
} else clearInterval(play);
7373
},1000)
74+
play();
7475
}
7576

7677
emptySnapshot() {

0 commit comments

Comments
 (0)