prevent bugs caused by calling functions out of order
This commit is contained in:
@@ -81,11 +81,17 @@ function add_time(time){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function start(){
|
function start(){
|
||||||
|
if(time_started){
|
||||||
|
return
|
||||||
|
}
|
||||||
time_started=Date.now()
|
time_started=Date.now()
|
||||||
localforage.setItem('time_started',time_started)
|
localforage.setItem('time_started',time_started)
|
||||||
}
|
}
|
||||||
|
|
||||||
function pause(){
|
function pause(){
|
||||||
|
if(!time_started){
|
||||||
|
return
|
||||||
|
}
|
||||||
time_passed+=Date.now()-time_started
|
time_passed+=Date.now()-time_started
|
||||||
time_started=null
|
time_started=null
|
||||||
localforage.removeItem('time_started')
|
localforage.removeItem('time_started')
|
||||||
|
|||||||
Reference in New Issue
Block a user