From 907cbea17aec6b9742059b3181d86879746b571b Mon Sep 17 00:00:00 2001 From: josephsmendoza Date: Fri, 14 Jul 2023 20:15:33 -0700 Subject: [PATCH] prevent bugs caused by calling functions out of order --- js/script.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/script.js b/js/script.js index 67cb3b3..24b22f9 100644 --- a/js/script.js +++ b/js/script.js @@ -81,11 +81,17 @@ function add_time(time){ } function start(){ + if(time_started){ + return + } time_started=Date.now() localforage.setItem('time_started',time_started) } function pause(){ + if(!time_started){ + return + } time_passed+=Date.now()-time_started time_started=null localforage.removeItem('time_started')