Can the countdown timer be realized by using functional normal form?

as described in the title, the requirement is to make a page similar to making a phone call, which requires a countdown, which needs to be terminated in three cases:

  • 30 seconds unanswered is regarded as a timeout, and should be terminated
  • the answer needs to be terminated within 30 seconds
  • within 30 seconds, the user hangs up actively and terminates

in any case, I can"t figure out how to isolate side effects.

is there any code or pseudo code to refer to?

Mar.23,2021

Link description


call the function in the timer to take the state, and then deal with it accordingly. What exactly does the side effect refer to?


it would be tedious to isolate the side effects with native ones. I wrote a simple one with RxJS for inspiration

.

https://jsfiddle.net/straybug.

Menu