aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/game.js b/game.js
index fa8ff23..1d06a2e 100644
--- a/game.js
+++ b/game.js
@@ -277,4 +277,11 @@ window.addEventListener("load", function() {
openGame();
});
-window.addEventListener("resize", resizeHandler);
+var resizeDebounceTimeout = null;
+window.addEventListener("resize", function() {
+ if (resizeDebounceTimeout != null) return;
+ resizeDebounceTimeout = setTimeout(function() {
+ resizeDebounceTimeout = null;
+ resizeHandler();
+ }, 50);
+});