Sha256: f2844631b3f017363acae205d67b1beba81d871aaf96266088b731fa9f83f693

Contents?: true

Size: 628 Bytes

Versions: 18

Compression:

Stored size: 628 Bytes

Contents

mumuki.startTimer = (() => {
  function startTimer(endDate) {
    var endTime = new Date(endDate).getTime();
    var currentTime = Date.now();
    var diffTime = endTime - currentTime;
    var duration = moment.duration(diffTime, 'milliseconds');
    var intervalDuration = 1000;

    var interval = mumuki.setInterval(function () {
      duration = moment.utc(duration - intervalDuration);
      if(duration.valueOf() <= 0) {
        clearInterval(interval);
        window.location.reload();
      } else {
        $('#timer').text(duration.format("HH:mm:ss"));
      }
    }, intervalDuration);
  }
  return startTimer
})();

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mumuki-laboratory-8.1.1 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-8.1.0 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.12.3 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-8.0.0 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.12.1 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.12.0 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.11.1 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.11.0 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.10.5 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.10.4 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.10.3 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.10.2 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.10.1 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.10.0 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.9.2 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.9.1 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.9.0 app/assets/javascripts/mumuki_laboratory/application/timer.js
mumuki-laboratory-7.8.0 app/assets/javascripts/mumuki_laboratory/application/timer.js