(event: string, properties: Record<string, any>)
| 2 | import { isReactNative } from './is-react-native'; |
| 3 | |
| 4 | export function track(event: string, properties: Record<string, any>) { |
| 5 | if (!(isBrowser() || isReactNative())) { |
| 6 | return; |
| 7 | } |
| 8 | |
| 9 | return fetch(`http://example.com/api/track`, { |
| 10 | method: 'POST', |
| 11 | body: JSON.stringify({ events: [{ type: event, data: properties }] }), |
| 12 | headers: { |
| 13 | 'content-type': 'application/json', |
| 14 | }, |
| 15 | mode: 'cors', |
| 16 | }); |
| 17 | } |
no test coverage detected
searching dependent graphs…