@fogrexon/glyph-arena-timer

Tick-driven timer scheduling for Glyph Arena. See also package README.

Exports

Generated from the package's source when the docs are built — do not edit this table by hand.

NameKind
Timertype
TimerHandletype
createTimerfunction

createTimer()

const timer = createTimer();

const handle = timer.delay(1, () => {});
const interval = timer.every(0.5, () => {});

timer.tick(nowSeconds);
timer.cancel(handle);
timer.dispose();

Methods

TimerHandle

number — opaque handle returned by delay and every.

Time

All values are in seconds. Nothing runs until tick() is called.

Origin

The first tick() sets the time origin. Schedules created before that tick are measured from the origin.

Zero intervals

delay(0) and every(0) fire on the next tick() after they become due.

Negative intervals

Negative seconds do not schedule. Returns a handle; cancel on that handle is a no-op.

Error handling

If a callback throws, other due callbacks still run; the first error is rethrown after the tick finishes.

Cancel during callback

Cancelling during a callback prevents rescheduling (every).

Dispose during a tick

dispose() is immediate. If a callback calls it, the remaining callbacks already due in the same tick() do not run, and later ticks fire nothing.