Display desktop notification on disconnect

This commit is contained in:
urkerab
2015-09-04 12:15:17 +01:00
parent c74c6aa545
commit 2c0fd2fefb

View File

@@ -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);
});