ThreePipe
    Preparing search index...

    Class HiddenPageClock

    Keeps frames coming while the page is hidden. A browser stops requestAnimationFrame in a hidden tab, and slows setTimeout to once a second and then to nothing; a timer in a worker keeps its pace. So while the page is hidden and someone holds the clock, a worker ticks about 60 times a second and each tick calls onTick(time); when the page is visible again it stops, and requestAnimationFrame drives the frames as before.

    Measured in Chrome 156 (macOS, 8.5 minutes hidden): about 62 ticks a second the whole time; setTimeout gave 1.6, then 0 from the third minute. A browser can still freeze a tab hidden for long (Chrome's Energy and Memory Saver). As of November 2026, Safari pauses a hidden tab anyway (tried with a recording); Firefox and phones are not tested yet. Rendering in the background uses the CPU and GPU, so hold it only for a task that needs it, like a recording.

    Does nothing where there is no document or Worker (Node.js). Used by RenderManager.keepRenderingWhenHidden.

    Index
    • Parameters

      • onTick: (time: number) => void

        called on each tick while the page is hidden and the clock is held, with performance.now()

      • interval: number = 16

        milliseconds between ticks

      Returns HiddenPageClock

    interval: number = 16

    milliseconds between ticks

    onTick: (time: number) => void

    called on each tick while the page is hidden and the clock is held, with performance.now()