Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
How can I work this out? Multiple timer for javascript for different rizzles

I have a database of rizzles and each one has a duration. I need to set a timer for each one (under determinated conditions) but I would not know how to handle that.

And of course, the timer if runs, have to be saved between pages, so I was thinking to do on the server side. It is a web application with React and NodeJS. I would show some code but I don't know what to write. I was thinking to a vector of idrizzle and duration in server side, but I would not know how to implement it.

Any ideas or suggestions?

EDIT:

I try to give you more details: - If the riddle is “open”, the author will see all current answers (updated every second), and a count-down showing the remaining time.

Means that every riddle has a duration, and if there are multiple riddle opened, I must have multiple "setInterval" or something that just decrease the duration and show to the user.

- selecting an “open” riddle, gives him/her the opportunity to reply (without showing any of the other replies, of course). Any user may provide at most one reply to each riddle, and it cannot be modified after submission. In the reply to an open riddle, a count-down shows the remaining time. If the remaining time is less than 50%, the first hint is shown. If the remaining time is less than 25%, also the second hint is shown.

This is pretty much the same. I need to take the countdown, probably from the front end.

In my DB i have only the full duration

EDIT 2:

An idea I came up with is to create a copy of my state and using to decrease the duration, problem is that I can see the decrease only when I close and open again:

//------TIMER------------
function decreaseDuration(){
  copy.map(e=>{
    if(e.state===1){
      if(e.duration>0){
        e.duration=e.duration-1;
      }
    }
  })
}
setInterval(decreaseDuration(),1000);

Is there any way I can live update the countdown?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda