Register window-focus and document-visibility listeners that pause /
resume the animation loop as the page goes background and back. Both
listeners early-return when FocusHandlingPorts.getRecordingPanel
reports an active capture, so offline recording keeps a stable loop.
getRecordingPanel is a live accessor (not a snapshot) so a focus
event that fires mid-dispose — after the orchestrator cleared its
recordingPanel field but before events.dispose() removes the
listener — sees the updated undefined and the optional-chain
short-circuits, matching the original this.recordingPanel?.…
behaviour.
Routed through the supplied EventGroup so the listeners are
cleaned up on dispose.
Register window-focus and document-visibility listeners that pause / resume the animation loop as the page goes background and back. Both listeners early-return when FocusHandlingPorts.getRecordingPanel reports an active capture, so offline recording keeps a stable loop.
getRecordingPanelis a live accessor (not a snapshot) so a focus event that fires mid-dispose — after the orchestrator cleared its recordingPanel field but beforeevents.dispose()removes the listener — sees the updatedundefinedand the optional-chain short-circuits, matching the originalthis.recordingPanel?.…behaviour.Routed through the supplied EventGroup so the listeners are cleaned up on dispose.