remotestorage-widget
Advanced tools
Comparing version 1.0.0-rc1 to 1.0.0-rc2
{ | ||
"name": "remotestorage-widget", | ||
"version": "1.0.0-rc1", | ||
"version": "1.0.0-rc2", | ||
"description": "remoteStorage.js connect widget", | ||
@@ -5,0 +5,0 @@ "main": "build/widget.js", |
@@ -37,2 +37,18 @@ # remotestorage-widget | ||
## Available Functions | ||
`attach(elementID)` - Attach the widget to the DOM and display it. You can | ||
use an optional element ID that the widget should be attached to. | ||
Otherwise it will be attached to the body. | ||
While the `attach()` method is required for the widget to be actually | ||
shown, the following functions are usually not needed. They allow for | ||
fine-tuning the experience. | ||
`close()` - Close/minimize the widget to only show the icon. | ||
`open()` - Open the widget when it's minimized. | ||
`toggle()` - Switch between open and closed state. | ||
## Development / Customization | ||
@@ -39,0 +55,0 @@ |
@@ -48,6 +48,6 @@ /** | ||
break; | ||
case 'req-done': | ||
case 'sync-req-done': | ||
this.rsSyncButton.classList.add("rs-rotate"); | ||
break; | ||
case 'done': | ||
case 'sync-done': | ||
this.rsSyncButton.classList.remove("rs-rotate"); | ||
@@ -65,3 +65,3 @@ | ||
if (!this.closed && this.shouldCloseWhenSyncDone) { | ||
setTimeout(this.closeWidget.bind(this), this.autoCloseAfter); | ||
setTimeout(this.close.bind(this), this.autoCloseAfter); | ||
} | ||
@@ -80,7 +80,7 @@ break; | ||
this.shouldCloseWhenSyncDone = true; | ||
this.rs.sync.on('req-done', () => this.eventHandler('req-done')); | ||
this.rs.sync.on('done', () => this.eventHandler('done')); | ||
this.rs.on('sync-req-done', () => this.eventHandler('sync-req-done')); | ||
this.rs.on('sync-done', () => this.eventHandler('sync-done')); | ||
} else { | ||
this.rsSyncButton.classList.add('rs-hidden'); | ||
setTimeout(this.closeWidget.bind(this), this.autoCloseAfter); | ||
setTimeout(this.close.bind(this), this.autoCloseAfter); | ||
} | ||
@@ -310,3 +310,3 @@ let connectedUser = this.rs.remote.userAddress; | ||
// Reduce to icon only if connected and clicked outside of widget | ||
document.addEventListener('click', () => this.closeWidget() ); | ||
document.addEventListener('click', () => this.close() ); | ||
@@ -317,3 +317,3 @@ // Clicks on the widget stop the above event | ||
// Click on the logo to toggle the widget's open/close state | ||
this.rsLogo.addEventListener('click', () => this.toggleWidget() ); | ||
this.rsLogo.addEventListener('click', () => this.toggle() ); | ||
}, | ||
@@ -327,5 +327,5 @@ | ||
*/ | ||
toggleWidget () { | ||
toggle () { | ||
if (this.closed) { | ||
this.openWidget(); | ||
this.open(); | ||
} else { | ||
@@ -335,3 +335,3 @@ if (this.state === 'initial') { | ||
} else { | ||
this.closeWidget(); | ||
this.close(); | ||
} | ||
@@ -341,3 +341,6 @@ } | ||
openWidget () { | ||
/** | ||
* Open the widget. | ||
*/ | ||
open () { | ||
this.closed = false; | ||
@@ -354,3 +357,3 @@ this.setState(this.active ? 'connected' : 'initial'); | ||
*/ | ||
closeWidget () { | ||
close () { | ||
// don't do anything when we have an error | ||
@@ -404,3 +407,3 @@ if (this.state === 'error') { return; } | ||
// console.debug('Encountered SyncError', error); | ||
this.openWidget(); | ||
this.open(); | ||
this.showErrorBox('App sync error'); | ||
@@ -413,6 +416,6 @@ }, | ||
} else { | ||
this.openWidget(); | ||
this.open(); | ||
this.showErrorBox(error.message + " "); | ||
this.rsErrorBox.appendChild(this.rsErrorReconnectLink); | ||
this.rsErrorReconnectLink.classList.remove('hidden'); | ||
this.rsErrorReconnectLink.classList.remove('rs-hidden'); | ||
} | ||
@@ -419,0 +422,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
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
345335
974
64