Skip to main content

work_pending

Function work_pending 

Source
pub fn work_pending(world: &World) -> bool
Expand description

Whether the tick that just ran left work behind, so a driver that only wakes on events has to schedule another frame.

Five sources, each of which reaches false on its own once the system settles, so a caller that loops on this can never spin forever:

  1. The external typed-property bus still holds undrained writes, from a cross-thread producer or a main-thread script write that landed after this tick’s drain. It empties once drained.
  2. The plugin-event bus still holds events a portable plugin pushed (see crate::plugin_events). It likewise empties once drained.
  3. A driver reported unfinished work this tick through AnimationsActive: a hover or press tween, an opacity transition, scroll inertia, an element still waiting on content that has not arrived. The flag is cleared at the top of every tick and re-raised only while the thing it is keyed on is still outstanding, and every driver keys its claim on something that settles or leaves the tree.
  4. FrameDirty is still set, which a system dirtying state after the encode leaves behind. The next present clears it.
  5. A WakeDeadline requested this tick has already passed. A driver that reaches a deadline hands its work out on the tick that follows, so the claim settles with it.

This is a frame predicate, not a state predicate: an app with a permanent animation raises the third source forever. A caller that needs to know when an app’s state stopped moving compares the state itself, as the prerenderer does.