diff options
author | Joris Guyonvarch | 2015-03-19 23:20:29 +0100 |
---|---|---|
committer | Joris Guyonvarch | 2015-03-19 23:21:00 +0100 |
commit | 17dbdaeea4f13c3fde35edbc745984ec31a2584c (patch) | |
tree | 5a40dc00ff83eac29d5b1758438957d103afe1ce /index.html | |
parent | 99b203c956f99875c7263c445668a425a463e416 (diff) |
Playing an ugly sound when a timer is ringing
Diffstat (limited to 'index.html')
-rw-r--r-- | index.html | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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; + } + }); + </script> </html> |