MCPcopy Create free account
hub / github.com/winfunc/opcode / flushEvents

Method flushEvents

src/lib/analytics/index.ts:225–241  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 3

trackMethod · 0.95
startFlushIntervalMethod · 0.95
shutdownMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected