Timer

loreline.Timer (Class)

Deferred timer system for non-blocking wait() on game-loop targets.

On sys targets, deferredMode starts false. Once the host calls update() (or enableDeferredMode() directly), deferred mode is active and wait() will register timers here instead of blocking with Sys.sleep().

For CLI/tool targets that never call update(), wait() falls back to the blocking Sys.sleep() path automatically.

Static Members

deferredMode: Bool

True once the host's update loop has been connected. Gates deferred vs. blocking wait() on sys targets.


enableDeferredMode(): Void

Proactively enable deferred mode without ticking timers. Call this before any interpreter work starts (e.g. in Loreline_createThread) to avoid a race condition where wait() runs before the first update().


register(seconds: Float, done: Function): Void

Register a timer to fire done after seconds have elapsed. Called by wait() when deferred mode is active.

Name Type
seconds Float
done Function

update(delta: Float): Void

Tick all pending timers by delta seconds, firing any that have expired. Call this every frame from your game loop. The first call also enables deferred mode on sys targets.

Name Type Description
delta Float Time elapsed since the last frame in seconds.

Private Members

Metadata

Name Parameters
:hxGen -