handle missing umami

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

View File

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