Creating a Utility to Postpone Effect Execution with Timeout Reset
New day, new question! I'm playing a bit with fibers and of course nothing works , but with a little help maybe I can learn something. I'd like to write an utility that helps me postpone the execution of an effect. There is a
timeout
timeout
, when the timeout expires
onTimeout
onTimeout
should be executed but if
postpone
postpone
gets called in the meantime, the timeout should reset.
Probably there are lot of things wrong in my attempt, but the main one I think is about interruption. I misunderstood it, I can't interrupt a fiber in that way from outside, that's not the way to re-execute a part of a fiber. What should I do?