Show confetti when purchasing a record

This commit is contained in:
Claudio Ortolina
2025-03-08 21:53:17 +00:00
parent a160b8c98d
commit 4a18129d31
6 changed files with 59 additions and 35 deletions
+7
View File
@@ -22,6 +22,7 @@ import { Socket } from "phoenix";
import { LiveSocket } from "phoenix_live_view";
import topbar from "../vendor/topbar";
import BarcodeScannerHook from "./barcode-scanner";
import confetti from "canvas-confetti";
let Hooks = {};
Hooks.BarcodeScanner = BarcodeScannerHook;
@@ -53,6 +54,12 @@ window.addEventListener("music_library:clipcopy", (event) => {
window.addEventListener("music_library:scroll_top", (_event) => {
window.scrollTo(0, 0);
});
window.addEventListener("music_library:confetti", (_event) => {
confetti({
particleCount: 100,
spread: 200,
});
});
// connect if there are any LiveViews on the page
liveSocket.connect();