Laravel Красноречивые отношения Много ко Многим

вы можете отделить таймер от функций, чтобы упростить его, и применить следующую логику

function startTimer () {
  val targetRemainedSeconds = // calculate the value
  val remainedSeconds = targetRemainedSeconds
  setInterval(timer(), 1000)
}
function timer () {
  remainedSeconds--
  if (remainedSeconds < 0) reaminedSeconds = targetReaminedSeconds // reset the timer 
  timerUpdate()
}
function timerUpdate() {
  // use 'remainedSeconds' to update timer 
}
-1
задан simonw16 18 January 2019 в 20:51
поделиться