From 17dbdaeea4f13c3fde35edbc745984ec31a2584c Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Thu, 19 Mar 2015 23:20:29 +0100 Subject: Playing an ugly sound when a timer is ringing --- index.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'index.html') diff --git a/index.html b/index.html index 352f6b1..5417dcc 100644 --- a/index.html +++ b/index.html @@ -28,6 +28,21 @@ } }); + const sound = new Audio('alarm.wav'); + sound.addEventListener('ended', function() { + this.currentTime = 0; + this.play(); + }, false); + + timer.ports.ringingTimers.subscribe(function(isRinging) { + if(isRinging) { + sound.play(); + } else { + sound.pause(); + sound.currentTime = 0; + } + }); + -- cgit v1.2.3