GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — opencode-mobile/shared/observability/lifecycle.ts at main · drpr/opencode-mobile Expand file tree/ Copy pathlifecycle.tsMore file actions 25 lines (22 loc) · 1007 Bytes / Copy pathlifecycle.tsFile metadata and controls25 lines (22 loc) · 1007 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 import { AppState } from 'react-native'; import type { Observability } from '@/shared/observability/types'; let installed = false; // Lifecycle instrumentation is intentionally tiny: one AppState listener, no // timers while backgrounded, and a best-effort flush on the way out. export function installObservabilityLifecycle(target: Observability) { if (installed) return; installed = true; let backgroundedAt = AppState.currentState === 'active' ? 0 : Date.now(); target.markStartup('lifecycle'); AppState.addEventListener('change', (state) => { if (state === 'active') { const backgroundedFor = backgroundedAt ? Math.max(0, Date.now() - backgroundedAt) : 0; backgroundedAt = 0; target.info('app.lifecycle', { phase: 'foreground', foreground: true, durationMs: backgroundedFor }); } else { if (!backgroundedAt) backgroundedAt = Date.now(); target.info('app.lifecycle', { phase: 'background', foreground: false }); void target.flush(); } }); } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |