(
eventName: EventName,
eventProperties: object = {},
)
| 47 | } |
| 48 | |
| 49 | export async function sendEvent( |
| 50 | eventName: EventName, |
| 51 | eventProperties: object = {}, |
| 52 | ) { |
| 53 | if (process.env.DISABLE_TELEMETRY === 'true') { |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | try { |
| 58 | const [version, distinctId] = await Promise.all([ |
| 59 | getCurrentVersion(), |
| 60 | getDistinctId(), |
| 61 | ]); |
| 62 | |
| 63 | Client.capture({ |
| 64 | distinctId, |
| 65 | event: eventName, |
| 66 | properties: { |
| 67 | version, |
| 68 | ...eventProperties, |
| 69 | }, |
| 70 | }); |
| 71 | } catch (e) { |
| 72 | // No-op |
| 73 | } |
| 74 | } |
no test coverage detected