How to make a timer decreasing in nodejs [closed]

-2

My intention is to make a decreasing timer in javascript, even if no one is on the site the timer continues to count against it.

How can I do this?

Thank you.

    
asked by anonymous 13.02.2016 / 18:47

1 answer

1
  

"timer decreasing in javascript, even if no one is on the site the timer continues to count down uncritically"

Why use a timer then? you can use the current date and decide what to do. For example, given the colors:

var cores = ['#faa', '#afa', '#aaf'];

You can then know how many minutes of such a day have passed and make some accounts ...

var agora = new Date();
var minutosEsteDia = (agora.getHours() * 60) + agora.getMinutes();
var meiasHoras = minutosEsteDia / 30;
var cor = Math.round(meiasHoras % (cores.length - 1));

Now give me the position 2 , ie: #aaf . Let's see what happens in half an hour:)

    
13.02.2016 / 20:54