Skip to content

Commit 04c6007

Browse files
add delay for function call when stopping recording a looper (#240)
Co-authored-by: Simon Thormeyer <simonthormeyer@gmail.com>
1 parent 33ffd40 commit 04c6007

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Frontend/src/components/menu.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ function Menu(props) {
2929
if (startLoop) {
3030
setListeningLooper(new Looper());
3131
} else {
32+
// delay function call only if listeningLooper does not exist yet
33+
if(!listeningLooper) {
34+
setTimeout(() => loopFunction(startLoop), 100);
35+
return;
36+
}
3237
listeningLooper.stopRecording(performance.now());
3338
setNextLooperID(nextLooperID + 1);
3439
runningLoopers.set(nextLooperID, listeningLooper);

0 commit comments

Comments
 (0)