MCPcopy Create free account
hub / github.com/dailydotdev/apps / logEventEnd

Function logEventEnd

packages/shared/src/hooks/log/useLogContextData.ts:65–80  ·  view source on GitHub ↗
(id, now = new Date())

Source from the content-addressed store, hash-verified

63 }
64 },
65 logEventEnd(id, now = new Date()) {
66 const event = durationEventsQueue.current.get(id);
67 if (event) {
68 if (!event.event_timestamp) {
69 throw new Error('Missing event timestamp for duration event');
70 }
71
72 durationEventsQueue.current.delete(id);
73 event.event_duration =
74 now.getTime() - event.event_timestamp.getTime();
75 if (window.scrollY > 0 && event.event_name !== 'page inactive') {
76 event.page_state = 'active';
77 }
78 pushToQueue([event]);
79 }
80 },
81 sendBeacon,
82 }),
83 [sharedPropsRef, getPage, pushToQueue, durationEventsQueue, sendBeacon],

Callers 4

callbackFunction · 0.85
useLogPageViewFunction · 0.85
useAutoRotatingAdsFunction · 0.85
useLogImpressionFunction · 0.85

Calls 1

getMethod · 0.80

Tested by 1

callbackFunction · 0.68