From 2c0fd2fefb259a91fa2d579cb417cd63cd6f9206 Mon Sep 17 00:00:00 2001 From: urkerab Date: Fri, 4 Sep 2015 12:15:17 +0100 Subject: [PATCH] Display desktop notification on disconnect --- js/client.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/client.js b/js/client.js index 597469c93..74046dfac 100644 --- a/js/client.js +++ b/js/client.js @@ -429,6 +429,11 @@ }); this.on('init:socketclosed', function () { + // Display a desktop notification if the user won't immediately see the popup. + if ((self.popups.length || !self.focused) && window.Notification) { + self.rooms[''].requestNotifications(); + new Notification("Reconnect to Showdown!", {lang: 'en', body: "You have been disconnected \u2014 possibly because the server was restarted."}); + } self.reconnectPending = true; if (!self.popups.length) self.addPopup(ReconnectPopup); });