( event: RuntimeAnalyticsEvent, properties?: RuntimeAnalyticsProperties, )
| 32 | * The host app receives it via postMessage and forwards to its analytics provider. |
| 33 | */ |
| 34 | export function emitAnalyticsEvent( |
| 35 | event: RuntimeAnalyticsEvent, |
| 36 | properties?: RuntimeAnalyticsProperties, |
| 37 | ): void { |
| 38 | if (!_postMessage) return; |
| 39 | try { |
| 40 | _postMessage({ |
| 41 | source: "hf-preview", |
| 42 | type: "analytics", |
| 43 | event, |
| 44 | properties: properties ?? {}, |
| 45 | }); |
| 46 | } catch (err) { |
| 47 | // Never let analytics failures affect the runtime |
| 48 | swallow("runtime.analytics.site1", err); |
| 49 | } |
| 50 | } |
no test coverage detected