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