()
| 223 | } |
| 224 | |
| 225 | private flushEvents(): void { |
| 226 | if (this.eventQueue.length === 0) return; |
| 227 | |
| 228 | const events = [...this.eventQueue]; |
| 229 | this.eventQueue = []; |
| 230 | |
| 231 | events.forEach(event => { |
| 232 | if (typeof posthog !== 'undefined' && posthog.capture) { |
| 233 | posthog.capture(event.event, { |
| 234 | ...event.properties, |
| 235 | $session_id: event.sessionId, |
| 236 | timestamp: event.timestamp, |
| 237 | $current_url: `opcode://${event.properties?.screen_name || 'unknown'}`, |
| 238 | }); |
| 239 | } |
| 240 | }); |
| 241 | } |
| 242 | |
| 243 | private startFlushInterval(): void { |
| 244 | // Flush events every 5 seconds |
no outgoing calls
no test coverage detected