victorwesterlund.com/public/assets/js/script.mjs
2022-02-18 15:37:14 +01:00

14 lines
No EOL
436 B
JavaScript

import { default as Glitch } from "./glitch/Glitch.mjs";
const logging = "https://victorwesterlund-logging-dnzfgzf6za-lz.a.run.app";
// Log link clicks
for(let link of document.getElementsByTagName("a")) {
link.addEventListener("click", event => {
event.preventDefault();
navigator?.sendBeacon(logging, event);
window.location.href = event.target.href;
});
}
window.glitch = new Glitch(document.body);