Teek API Documentation

A cancellable repeating timer that fires on the main thread.

Created via App#every. Reschedules itself after each tick using Tcl’s after command. The block runs in the event loop, so it must complete quickly to avoid blocking the UI.

Tracks timing drift: if a tick fires significantly late (more than 2x the interval), a warning is printed to stderr. This helps catch blocks that are too slow for the requested interval.

Inherits: Object

Instance Methods

cancel

Stop the timer. Safe to call multiple times.

Returns void

cancelled?

Returns Boolean — true if the timer has been cancelled

initialize(app, ms, on_error: nil, &block)

Returns RepeatingTimer — a new instance of RepeatingTimer

@api private

@raise ArgumentError

Attributes

interval [R]

Returns Integer — interval in milliseconds

last_error [R]

Returns Exception, nil — the last error if the timer stopped due to an unhandled exception, nil otherwise

late_ticks [R]

Returns Integer — number of ticks that fired late (> 2x interval)