Add website's pixel count tracker

This commit is contained in:
2024-07-27 14:57:12 +02:00
parent 6aebac4578
commit d5aaccd616
11 changed files with 986 additions and 37255 deletions
+14
View File
@@ -0,0 +1,14 @@
// Creating artificial API between two worlds
const log = console.log;
console.log = (...args: any) => {
const firstArg = args[0];
if (firstArg && typeof firstArg === "object" && "pixelsPlaced" in firstArg) {
const pixelsPlaced = new CustomEvent("__pixelsPlaced", {
detail: firstArg.pixelsPlaced,
});
document.dispatchEvent(pixelsPlaced);
}
log(...args);
};