mirror of
https://github.com/RobinLinus/snapdrop.git
synced 2025-05-21 10:00:57 -07:00
Show a basic notification when user is offline
This commit is contained in:
parent
16b64a98cc
commit
c68a7ad987
@ -414,6 +414,25 @@ class Notifications {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class NetworkStatusUI{
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
window.addEventListener('offline', e => this._showOfflineMessage(), false);
|
||||||
|
window.addEventListener('online', e => this._showOnlineMessage(), false);
|
||||||
|
if(!navigator.onLine) this._showOfflineMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
_showOfflineMessage(){
|
||||||
|
Events.fire('notify-user','You are offline');
|
||||||
|
}
|
||||||
|
|
||||||
|
_showOnlineMessage(){
|
||||||
|
Events.fire('notify-user','You are back online');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class Snapdrop {
|
class Snapdrop {
|
||||||
constructor() {
|
constructor() {
|
||||||
const server = new ServerConnection();
|
const server = new ServerConnection();
|
||||||
@ -425,6 +444,7 @@ class Snapdrop {
|
|||||||
const receiveTextDialog = new ReceiveTextDialog();
|
const receiveTextDialog = new ReceiveTextDialog();
|
||||||
const toast = new Toast();
|
const toast = new Toast();
|
||||||
const notifications = new Notifications();
|
const notifications = new Notifications();
|
||||||
|
const networkStatusUI = new NetworkStatusUI();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user