aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLieuwe Rooijakkers <lieuwerooijakkers@gmail.com>2024-02-17 21:46:25 +0100
committerLieuwe Rooijakkers <lieuwerooijakkers@gmail.com>2024-02-17 21:46:46 +0100
commit08e2cef4ff94ef358acf78cee92153d02f9e28fb (patch)
tree4e2083e1ab0a2dc64d8bbbc109820dc20e4957cb
parent574882d3135e8e9f8b15e252b0b8c2e5d767ae0c (diff)
playSound: use performance.now
-rw-r--r--game.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/game.js b/game.js
index ee9da93..e34f4c2 100644
--- a/game.js
+++ b/game.js
@@ -303,7 +303,7 @@ function preloadSounds() {
var lastSoundStampMap = {};
function playSound(name) {
- var now = new Date();
+ var now = performance.now();
console.log("playSound(\"" + name + "\")");
if (lastSoundStampMap[name] == null || now - lastSoundStampMap[name] >= 500) {
soundMap[name].play();