Examples
import { App, CorePlugin, ReflectPlugin } from 'wima'
new App()
.registerPlugin(new ReflectPlugin())
.registerPlugin(new CorePlugin()) // installs defaultRunner
.run()Function
defaultRunner(scheduler: Scheduler, worlds: WorldRegistry): voidRuns an app’s registered schedule callbacks from a browser animation-frame loop.
This function implements the Runner contract used by App.
The app passes it a Scheduler and its Worlds registry,
which maps world type IDs to worlds.
When called, it reads performance.now() once and records each
Executable’s first due time as that reading plus its delay. It
then requests the first requestAnimationFrame callback; no schedule
callback runs synchronously during this call. On each frame, cross-world
entries are processed before normal entries, and each registry’s insertion
order from Scheduler is preserved.
For a due entry, the configured world labels are converted with typeid and
looked up with worlds.get. Cross-world callbacks receive the target world
first and the source world second; normal callbacks receive only their target
world. A repeating entry schedules its next run at the current frame time
plus delay, while an entry with repeat: false is deactivated after its
first run. The delay uses the browser’s performance.now()/animation-frame
time units.
After both registries are processed, the loop requests another animation
frame. This function does not catch failures: a missing target or source
world throws from its assertion, and an exception that escapes a schedule or
its configured error handler propagates from the frame callback. If a failure
occurs before the final requestAnimationFrame call, that callback does not
reschedule itself.
import { App, CorePlugin, ReflectPlugin } from 'wima'
new App()
.registerPlugin(new ReflectPlugin())
.registerPlugin(new CorePlugin()) // installs defaultRunner
.run()