mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-21 23:36:17 -04:00
Fix offline capability: Cache first -> fetch from network second. From now on, updates are only possible by increasing cacheVersion
This commit is contained in:
parent
8eb6e5bfab
commit
2131307fc6
6 changed files with 86 additions and 58 deletions
|
@ -37,7 +37,7 @@ class ServerConnection {
|
|||
|
||||
_connect() {
|
||||
clearTimeout(this._reconnectTimer);
|
||||
if (this._isConnected() || this._isConnecting()) return;
|
||||
if (this._isConnected() || this._isConnecting() || this._isOffline()) return;
|
||||
if (this._isReconnect) {
|
||||
Events.fire('notify-user', {
|
||||
message: Localization.getTranslation("notifications.connecting"),
|
||||
|
@ -246,6 +246,10 @@ class ServerConnection {
|
|||
return this._socket && this._socket.readyState === this._socket.CONNECTING;
|
||||
}
|
||||
|
||||
_isOffline() {
|
||||
return !navigator.onLine;
|
||||
}
|
||||
|
||||
_onError(e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue