From 6fc3e1c05735418c2ee3bcf0b5dc3018ca66a7c1 Mon Sep 17 00:00:00 2001 From: Grzegorz Kucmierz Date: Sat, 21 Feb 2026 23:24:40 +0000 Subject: [PATCH] Enhance vibration pattern on game win with error handling --- src/components/WinModal.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/WinModal.vue b/src/components/WinModal.vue index 473c5fa..0d4ed39 100644 --- a/src/components/WinModal.vue +++ b/src/components/WinModal.vue @@ -36,10 +36,14 @@ const handleKeyDown = (e) => { const triggerVibration = () => { if (!('vibrate' in navigator)) return; - const isCoarse = window.matchMedia?.('(pointer: coarse)')?.matches; - const isTouch = navigator.maxTouchPoints && navigator.maxTouchPoints > 0; - if (isCoarse || isTouch) { - navigator.vibrate([80, 40, 120, 40, 180]); + try { + const isCoarse = window.matchMedia?.('(pointer: coarse)')?.matches; + const isTouch = navigator.maxTouchPoints && navigator.maxTouchPoints > 0; + if (isCoarse || isTouch) { + navigator.vibrate([200, 100, 200, 100, 200]); + } + } catch (e) { + console.error('Vibration failed:', e); } };