Skip to content

1681-engine / index / onAppResume

Function: onAppResume() ​

ts
function onAppResume(cb, env?): () => void;

Defined in: src/platform/appResume.ts:14

Calls cb when the app comes back to the foreground: the tab shown again (visibilitychange) or the page restored from the back/forward cache (pageshow with persisted). A phone freezes a background tab — timers stop, a socket may be dead without having closed — so this is the moment to check what survived. cb gets how long the app was hidden, ms (0 when the hiding was not seen). Returns the unsubscribe; does nothing where there is no document.

Parameters ​

ParameterType
cb(hiddenMs) => void
envResumeEnv

Returns ​

() => void

Released under the MIT License.