import * as EventData from "../events.json";
import { getAttributesFromEvent } from "../functions/getAttributesFromEvent";

export const clickEvent = (ip: any) => {
  if (typeof window !== "undefined") {
    console.log("WINDOW FOUND");
    window.addEventListener(
      "click",
      async (e: any) => {
        console.log("click event triggered");
        const attr = await getAttributesFromEvent(e.target, ip, 5);
        // @ts-ignore
        console.log("event triggered attr", EventData[attr]);
      },
      false
    );
  }
};
