Resume Time on Stopwatch App

You must Login before you can answer or comment on any questions.

Hello again,

I have actually attempted at trying to make my Stopwatch resume time after it has been stopped/paused. I am trying to make the "Stop" button to perform another action, which is to resume the time. I am using JavaScript and Titanium Studio (Android) to create this app. Can anyone guide me or help me out in this situation? Here is part of the code:

var _startStopwatch = function() {
    timerlabel.value = '00:00:00.0';
 
var startTime = new Date();
var stopTime = null;
 
var _stopStopwatch = function() {
        clearInterval(intervalid);
        startTime = null;
  };
 
var _resumeTime = function() {
    var day = new Date();
    return day.getTime();
 
};
 
var _getTime = function() {
     var day = new Date();
    return day.getTime();
}
 
    var started = false;
    var intervalid = null;
    var resume = true;
    var i = i++;
 
//START BUTTON
button01.addEventListener("click", function(e){
    if (!started) {
        _startStopwatch();
        started = true;
      } 
});
 
//STOP BUTTON
button03.addEventListener("click", function(e){
    if (started) {    
        _stopStopwatch();
        started = false;
        return;
    } else if (!started) {
       stopTime = getTime();
           stopTime.start
       return i; 
       _resumeTime()    
}
});

Your Answer

Think you can help? Login to answer this question!