File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -231,7 +231,11 @@ require(
231
231
Reveal .addKeyBinding (
232
232
{ keyCode: 84 , key: " T" , description: " Start the exercise timer" },
233
233
() => {
234
- let exerciseTime = prompt (" Timer duration in minutes" );
234
+ let exerciseTime = prompt (" Timer duration in minutes (leave empty to cancel)" );
235
+ const cleanup = () => {
236
+ clearInterval (updateExerciseTimerInterval);
237
+ $ (' .exercise-timer' ).remove ();
238
+ }
235
239
if (exerciseTime !== undefined && exerciseTime !== " " && exerciseTime !== null ){
236
240
if (! isNaN (exerciseTime) && exerciseTime >= 0.1 ) {
237
241
exerciseTime = Duration .fromMillis (exerciseTime * 60 * 1000 );
@@ -267,14 +271,12 @@ require(
267
271
audio .play ();
268
272
}
269
273
else if (secondsRemaining >= - 5 ) $ (' .exercise-timer' ).text (" TIME'S UP" ).css (' color' , ' red' );
270
- else {
271
- clearInterval (updateExerciseTimerInterval);
272
- $ (' .exercise-timer' ).remove ();
273
- }
274
+ else cleanup ();
274
275
}
275
276
updateExerciseTimerInterval = setInterval (updateTimer, updateFrequency);
276
277
}
277
278
}
279
+ else cleanup ();
278
280
}
279
281
);
280
282
You can’t perform that action at this time.
0 commit comments