lib/polyphony/core/timer.rb
# Runs the given block in an infinite loop with a regular interval between
# consecutive iterations.
#
# @param interval [Number] interval between consecutive iterations in seconds
# @param &block [Proc] block to run
# @return [void]
Runs the given block in an infinite loop with a regular interval between
consecutive iterations.
Runs the given block in an infinite loop with a regular interval between consecutive iterations .
def every(interval)
      fiber = Fiber.current
      @timeouts[fiber] = {
        interval: interval,
        target_stamp: now + interval,
        recurring: true
      }
      while true
        Polyphony.backend_wait_event(true)
        yield
      end
    ensure
      @timeouts.delete(fiber)
    end
def every ( interval ) fiber = Fiber . current @timeouts [ fiber ] = { interval : interval , target_stamp : now + interval , recurring : true } while true Polyphony . backend_wait_event ( true ) yield end ensure @timeouts . delete ( fiber ) end
Runs the given block in an infinite loop with a regular interval between
consecutive iterations.
Runs the given block in an infinite loop with a regular interval between consecutive iterations .
None
void
interval
interval between consecutive iterations in seconds
interval between consecutive iterations in seconds
&block
<not_specific>
block to run
block to run