aboutsummaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-19 23:20:29 +0100
committerJoris Guyonvarch2015-03-19 23:21:00 +0100
commit17dbdaeea4f13c3fde35edbc745984ec31a2584c (patch)
tree5a40dc00ff83eac29d5b1758438957d103afe1ce /index.html
parent99b203c956f99875c7263c445668a425a463e416 (diff)
Playing an ugly sound when a timer is ringing
Diffstat (limited to 'index.html')
-rw-r--r--index.html15
1 files changed, 15 insertions, 0 deletions
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;
+ }
+ });
+
</script>
</html>