telex-amp
Version:
Lightweight React Native tracking library for performance and error logging with Telex Webhooks
16 lines (13 loc) • 454 B
text/typescript
import { sendDataToTelex } from "./trackingHelper";
export function trackPerformance(event: string) {
const startTime = performance.now();
return function stopTracking() {
const endTime = performance.now();
sendDataToTelex({
event_name: "performance",
message: `${event} took ${endTime - startTime}ms`,
status: "success",
timestamp: new Date().toISOString(),
});
};
}