enum FrameTasks
Swift
enum FrameTasks
Work deferred until the current frame is on screen.
Exists for the one thing a synchronous UI thread cannot otherwise express:
a visible "before". A click handler about to spend seconds reading and
parsing a large file can set its status text, hand the actual work to
after, and return — the loop paints "Loading…", presents it, then runs
the work. Doing both inline instead puts the state change and the stall in
the same frame, so the status is never drawn and the window simply freezes
with stale content, which is indistinguishable from nothing happening.
Not a thread pool and not a substitute for one: the work still runs on the main thread and still blocks it. What it buys is that the user is told what is blocking, and which file, before it starts.
Sources/LavaUI/State.swift:421
Properties
static var hasPending: Bool { get }
Not documented.
Sources/LavaUI/State.swift:441
Methods
static func after(_ work: @escaping () -> Void)
Not documented.
Sources/LavaUI/State.swift:424
static func drain()
Drained by LavaApp.run right after present. Swaps the queue out first,
so work that enqueues more work lands on the next frame rather than
extending this stall.
Sources/LavaUI/State.swift:434