Skip to content

watchPageVisibility

watchPageVisibility(target): () => void

Defined in: pageVisibility.ts:25

Tell target whether the page is visible, now and on every change: visibilitychange, pagehide/pageshow (the back/forward cache) and freeze/resume (a page the browser froze). When the page is shown again it also calls checkDeadline(), so a hold that ran out while timers were throttled or frozen is applied. Outside a browser it does nothing. Returns a cleanup that removes every listener.

openStream calls it for a choreographer it creates; useIsland and the custom elements call it for their own. Call it yourself when you create a CopyChoreographer and pass it to openStream({ choreographer }).

VisibilityTarget

() => void