MCPcopy Index your code
hub / github.com/winfunc/opcode / useAppLifecycle

Function useAppLifecycle

src/hooks/useAnalytics.ts:370–384  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

368}
369
370export function useAppLifecycle() {
371 useEffect(() => {
372 // Track app start
373 analytics.track(ANALYTICS_EVENTS.APP_STARTED);
374
375 // Track app close
376 const handleUnload = () => {
377 analytics.track(ANALYTICS_EVENTS.APP_CLOSED);
378 analytics.shutdown();
379 };
380
381 window.addEventListener('beforeunload', handleUnload);
382 return () => window.removeEventListener('beforeunload', handleUnload);
383 }, []);
384}
385
386// Hook for tracking component-specific metrics
387export function useComponentMetrics(componentName: string) {

Callers 1

AppContentFunction · 0.90

Calls 1

trackMethod · 0.80

Tested by

no test coverage detected