LoopRunner

Abstraction that allows to run loops at a certain frequency in a platforrm agnostic way.

This is useful for interop with backends that do nor provide Thread.sleep or that require that an event loop keeps being consumed.

Companion:
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def finiteLoop[S](operation: S => S, terminateWhen: S => Boolean, frequency: LoopFrequency, cleanup: () => Unit): Loop[S]

Creates a loop that terminates once a certain condition is met.

Creates a loop that terminates once a certain condition is met.

Type parameters:
S

State

Value parameters:
cleanup

cleanup procedure to run when the loop is finished

frequency

frequency cap for this loop

operation

operation to perform at each iteration

terminateWhen

stopping condition