mymusics

retro MySpace-style music player
Log | Files | Refs | README

reportEvent.ts (355B)


      1 export type ClientEventType = "stream_error" | "time_to_play";
      2 
      3 export function reportEvent(payload: {
      4   type: ClientEventType;
      5   trackId?: string;
      6   detail?: string;
      7   ms?: number;
      8 }): void {
      9   void fetch("/api/events", {
     10     method: "POST",
     11     headers: { "Content-Type": "application/json" },
     12     body: JSON.stringify(payload),
     13   }).catch(() => {});
     14 }