22 lines · 698 B · TypeScript
RawDownload
/** * Tracks app-initiated OS-surface handoffs (image picker, auth tab, share * sheet). Android reports the app as backgrounded while one of these covers * the activity, so background-triggered work — like a deferred app update * restart — has to wait them out instead of tearing down the mid-flow runtime. */let activeHandoffs = 0; /** Returns an idempotent end function; call it when the handoff resolves. */export function beginForegroundHandoff(): () => void {  activeHandoffs += 1;  let ended = false;  return () => {    if (ended) return;    ended = true;    activeHandoffs -= 1;  };} export function isForegroundHandoffActive(): boolean {  return activeHandoffs > 0;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t