123456789101112131415161718192021222324252627282930313233 |
- var message = document.getElementById("message");
- var timer = document.getElementById("timer");
- var button = document.getElementById("button");
- var audio = document.getElementById("audiotag");
- var Timers = /** @class */ (function () {
- function Timers() {
- }
- Timers.prototype.countDown = function (minutes) {
- var orginalTime = minutes;
- var counter = minutes * 60;
- var interval = setInterval(function () {
- var minutes = Math.floor(counter / 60);
- var second = counter % 60;
- if (second < 10) {
- second = "0" + second;
- }
- timer.innerHTML = minutes + " : " + second;
- counter--;
- if (counter < 0) {
- audio.play();
- }
- if (counter < 0) {
- button.style.visibility = "visible";
- clearInterval(interval);
- console.log('it worked');
- }
- }, 1000);
- };
- return Timers;
- }());
- var timers = new Timers;
- button.addEventListener('click', function () { timers.countDown(5); button.style.visibility = "hidden"; });
|