handle missing umami

This commit is contained in:
CrispyBaguette 2023-10-08 11:25:41 +02:00
parent 7e1dc8c443
commit 607e7f44e9

View File

@ -26,11 +26,16 @@ function App() {
const ditheredImage = await new Ditherer().dither(imageArray, palette);
setDitheredImage(new Blob([ditheredImage], { type: "image/png" }));
setAppState(AppState.IMAGE_PROCESSED);
(window as any).umami.track("image processed");
if ("umami" in window) {
(window as any).umami.track("image processed");
}
} catch (e) {
console.error(e);
window.alert("Something went wrong. Please try again.");
(window as any).umami.track("processing error");
if ("umami" in window) {
(window as any).umami.track("processing error");
}
}
};