From: Carl Worth Date: Sat, 6 Jun 2020 19:27:57 +0000 (-0700) Subject: Delay the "Connection lost" message by a second X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=commitdiff_plain;h=6c0ef34689d35ec9deada19903f7e307f5ac618a Delay the "Connection lost" message by a second Otherwise, when simply clicking a link to navigate away from the page, this scary-looking red box can appear. Nobody should complain if it takes a few seconds for the game to notice a connection is lost. --- diff --git a/scribe/scribe.jsx b/scribe/scribe.jsx index 81296dc..06a8541 100644 --- a/scribe/scribe.jsx +++ b/scribe/scribe.jsx @@ -26,7 +26,9 @@ const events = new EventSource("events"); events.onerror = function(event) { if (event.target.readyState === EventSource.CLOSED) { + setTimeout(() => { add_message("danger", "Connection to server lost."); + }, 1000); } };