MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / start

Function start

assets/js/Pomodoro.js:16–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14}
15
16function start() {
17 click.play();
18 if (add == 1) {
19 minutes = 0;
20 } else {
21 minutes = add - 1 || 24;
22 }
23 seconds = 59;
24 document.getElementById("minutes").innerHTML = minutes;
25 document.getElementById("seconds").innerHTML = seconds;
26
27 var minute_inetrval = setInterval(minutesTimer, 60000);
28 var seconds_interval = setInterval(secondsTimer, 1000);
29 function minutesTimer() {
30 minutes = minutes - 1;
31 document.getElementById("minutes").innerHTML = minutes;
32 }
33 function secondsTimer() {
34 seconds = seconds - 1;
35 document.getElementById("seconds").innerHTML = seconds;
36
37 if (seconds <= 0) {
38 if (minutes <= 0) {
39 clearInterval(minute_inetrval);
40 clearInterval(seconds_interval);
41 document.getElementById("done").innerHTML =
42 "Session Completed ! Take a break";
43 document.getElementById("done").classList.add("show");
44
45 bell.play();
46 }
47 seconds = 60;
48 }
49 }
50}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected