TODO needs proper introduction and links to relevant classes etc
Constructor for global remoteStorage object.
This class primarily contains feature detection code and a global convenience API.
Depending on which features are built in, it contains different attributes and functions. See the individual features for more information.
RemoteStorage | TODO needs proper introduction and links to relevant classes etc |
Events | |
ready | Fired when ready |
not-connected | Fired when ready, but no storage connected (“anonymous mode”) |
connected | Fired when a remote storage has been connected |
disconnected | Fired after disconnect |
error | Fired when an error occurs |
features-loaded | Fired when all features are loaded |
connecting | Fired before webfinger lookup |
authing | Fired before redirecting to the authing server |
wire-busy | Fired when a wire request starts |
wire-done | Fired when a wire request completes |
Functions | |
RemoteStorage.log | Log using console.log, when remoteStorage logging is enabled. |
displayWidget | Displays the widget at the top right of the page. |
connect | Connect to a remoteStorage server. |
disconnect | “Disconnect” from remotestorage server to terminate current session. |
onChange | Add a “change” event handler to the given path. |
enableLog | Enable remoteStorage logging |
disableLog | Disable remoteStorage logging |
log | The same as RemoteStorage.log. |
setApiKeys (experimental) | Set API keys for (currently) GoogleDrive and/or Dropbox backend support. |
Properties | |
connected | Boolean property indicating if remoteStorage is currently connected. |
access | Tracking claimed access scopes. |
caching | Caching settings. |
remote | Access to the remote backend used. |
local | Access to the local caching backend used. |
RemoteStorage.log = function()
Log using console.log, when remoteStorage logging is enabled.
You can enable logging with enableLog.
onChange: function( path, handler )
Add a “change” event handler to the given path. Whenever a “change” happens (as determined by the backend, such as e.g. RemoteStorage.IndexedDB) and the affected path is equal to or below the given ‘path’, the given handler is called.
You should usually not use this method directly, but instead use the “change” events provided by RemoteStorage.BaseClient.
path | Absolute path to attach handler to. |
handler | Handler function. |
log: function()
The same as RemoteStorage.log.
setApiKeys: function( type, keys )
Set API keys for (currently) GoogleDrive and/or Dropbox backend support. See also the ‘backends’ example in the starter-kit. Note that support for both these backends is still experimental.
type | string, either ‘googledrive’ or ‘dropbox’ |
keys | object, with one string field; ‘client_id’ for GoogleDrive, or ‘api_key’ for Dropbox. |
Tracking claimed access scopes. A RemoteStorage.Access instance.
Caching settings. A RemoteStorage.Caching instance.
Not available in no-cache builds.
Access to the remote backend used. Usually a RemoteStorage.WireClient.
Access to the local caching backend used. Usually either a RemoteStorage.IndexedDB or RemoteStorage.LocalStorage instance.
Not available in no-cache builds.
Log using console.log, when remoteStorage logging is enabled.
RemoteStorage.log = function()
Connect to a remoteStorage server.
connect: function( userAddress )
“Disconnect” from remotestorage server to terminate current session.
disconnect: function()
Add a “change” event handler to the given path.
onChange: function( path, handler )
Enable remoteStorage logging
enableLog: function()
Disable remoteStorage logging
disableLog: function()
The same as RemoteStorage.log.
log: function()
Set API keys for (currently) GoogleDrive and/or Dropbox backend support.
setApiKeys: function( type, keys )