remotestorage-widget
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "remotestorage-widget", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "remoteStorage.js connect widget", | ||
@@ -45,3 +45,3 @@ "main": "build/widget.js", | ||
"raw-loader": "^0.5.1", | ||
"remotestoragejs": "1.0.0-rc5", | ||
"remotestoragejs": "1.0.1", | ||
"rimraf": "^2.4.3", | ||
@@ -48,0 +48,0 @@ "svg-inline-loader": "^0.7.1", |
@@ -74,3 +74,3 @@ /** | ||
this.active = false; | ||
this.online = false; | ||
this.setOnline(); | ||
this.setBackendClass(); // removes all backend CSS classes | ||
@@ -93,13 +93,10 @@ this.setState('initial'); | ||
this.setBackendClass(this.rs.backend); | ||
this.rsConnectedLabel.textContent = 'Connected'; | ||
this.setState('connected'); | ||
break; | ||
case 'network-offline': | ||
this.online = false; | ||
// this.active = false; | ||
this.setState(); | ||
this.setOffline(); | ||
break; | ||
case 'network-online': | ||
this.online = true; | ||
this.active = true; | ||
this.setState(); | ||
this.setOnline(); | ||
break; | ||
@@ -138,17 +135,5 @@ case 'error': | ||
this.rsWidget.classList.add(`rs-state-${state || this.state}`); | ||
if (this.closed && state !== 'close') { | ||
this.rsWidget.classList.add('rs-state-close'); | ||
} | ||
this.state = state; | ||
} | ||
if (!this.online && this.active) { | ||
this.rsWidget.classList.add('rs-state-offline'); | ||
// TODO offline is not the same as "not connected" | ||
this.rsConnectedLabel.textContent = 'Not Connected'; | ||
} else { | ||
this.rsConnectedLabel.textContent = 'Connected'; | ||
this.rsWidget.classList.remove('rs-state-offline'); | ||
} | ||
}, | ||
@@ -347,3 +332,3 @@ | ||
this.closed = false; | ||
this.setState(this.active ? 'connected' : 'initial'); | ||
this.rsWidget.classList.remove('rs-closed'); | ||
this.shouldCloseWhenSyncDone = false; // prevent auto-closing when user opened the widget | ||
@@ -363,4 +348,4 @@ }, | ||
if (!this.leaveOpen && this.active) { | ||
this.setState('close'); | ||
this.closed = true; | ||
this.rsWidget.classList.add('rs-closed'); | ||
} else { | ||
@@ -371,3 +356,34 @@ this.setState(this.active ? 'connected' : 'initial'); | ||
/** | ||
* Mark the widget as offline. | ||
* | ||
* This will not do anything when no account is connected. | ||
* | ||
* @private | ||
*/ | ||
setOffline () { | ||
if (this.online) { | ||
this.rsWidget.classList.add('rs-offline'); | ||
this.rsConnectedLabel.textContent = 'Offline'; | ||
this.online = false; | ||
} | ||
}, | ||
/** | ||
* Mark the widget as online. | ||
* | ||
* @private | ||
*/ | ||
setOnline () { | ||
if (!this.online) { | ||
this.rsWidget.classList.remove('rs-offline'); | ||
if (this.active) { | ||
this.rsConnectedLabel.textContent = 'Connected'; | ||
} | ||
} | ||
this.online = true; | ||
}, | ||
/** | ||
* Set the remoteStorage backend type to show the appropriate icon. | ||
@@ -397,3 +413,3 @@ * If no backend is given, all existing backend CSS classes will be removed. | ||
this.rsErrorBox.innerHTML = ''; | ||
this.setState('close'); | ||
this.close(); | ||
}, | ||
@@ -400,0 +416,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
348115
1009