(action) add pause button

This commit is contained in:
2020-07-11 00:52:38 +02:00
parent bb2df9ea79
commit b81983acdf
2 changed files with 15 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ export const useTimer = () => {
const start = () => {
timeState.value = 'started'
notify('La session commence !')
notify(seconds.value ? 'La session reprend !' : 'La session commence !')
stopwatchId = setInterval(() => {
seconds.value++
@@ -54,7 +54,7 @@ export const useTimer = () => {
}, 1000)
}
const clear = () => {
const pause = () => {
timeState.value = 'stopped'
if (stopwatchId) {
clearInterval(stopwatchId)
@@ -64,6 +64,10 @@ export const useTimer = () => {
clearInterval(stopWatchSessionId)
stopWatchSessionId = null
}
}
const clear = () => {
pause()
seconds.value = 0
sessionSeconds.value = intervalSeconds.value
isProgrammer1Turn.value = true
@@ -72,6 +76,7 @@ export const useTimer = () => {
return {
interval,
start,
pause,
clear,
timeState,
time,