RemoteStorage

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.

Summary
RemoteStorageTODO needs proper introduction and links to relevant classes etc
Events
readyFired when ready
not-connectedFired when ready, but no storage connected (“anonymous mode”)
connectedFired when a remote storage has been connected
disconnectedFired after disconnect
errorFired when an error occurs
features-loadedFired when all features are loaded
connectingFired before webfinger lookup
authingFired before redirecting to the authing server
wire-busyFired when a wire request starts
wire-doneFired when a wire request completes
Functions
RemoteStorage.logLog using console.log, when remoteStorage logging is enabled.
displayWidgetDisplays the widget at the top right of the page.
connectConnect to a remoteStorage server.
disconnect“Disconnect” from remotestorage server to terminate current session.
onChangeAdd a “change” event handler to the given path.
enableLogEnable remoteStorage logging
disableLogDisable remoteStorage logging
logThe same as RemoteStorage.log.
setApiKeys (experimental)Set API keys for (currently) GoogleDrive and/or Dropbox backend support.
Properties
connectedBoolean property indicating if remoteStorage is currently connected.
accessTracking claimed access scopes.
cachingCaching settings.
remoteAccess to the remote backend used.
localAccess to the local caching backend used.

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

Arguments

the error

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

RemoteStorage.log = function()

Log using console.log, when remoteStorage logging is enabled.

You can enable logging with enableLog.

displayWidget

Displays the widget at the top right of the page.  Make sure to call this function once on every pageload (after the html ‘body’ tag), unless you use a custom widget.

Parameters

domID: identifier of the DOM element which should embody the widget (optional)

connect

connect: function(userAddress)

Connect to a remoteStorage server.

Parameters

userAddressThe user address (user@host) to connect to.

Discovers the webfinger profile of the given user address and initiates the OAuth dance.

This method must be called after all required access has been claimed.

disconnect

disconnect: function()

”Disconnect” from remotestorage server to terminate current session.  This method clears all stored settings and deletes the entire local cache.

onChange

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.

Parameters

pathAbsolute path to attach handler to.
handlerHandler function.

enableLog

enableLog: function()

Enable remoteStorage logging

disableLog

disableLog: function()

Disable remoteStorage logging

log

log: function()

The same as RemoteStorage.log.

setApiKeys (experimental)

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.

Parameters

typestring, either ‘googledrive’ or ‘dropbox’
keysobject, with one string field; ‘client_id’ for GoogleDrive, or ‘api_key’ for Dropbox.

Properties

connected

Boolean property indicating if remoteStorage is currently connected.

access

Tracking claimed access scopes.  A RemoteStorage.Access instance.

caching

Caching settings.  A RemoteStorage.Caching instance.

Not available in no-cache builds.

remote

Access to the remote backend used.  Usually a RemoteStorage.WireClient.

local

Access to the local caching backend used.  Usually either a RemoteStorage.IndexedDB or RemoteStorage.LocalStorage instance.

Not available in no-cache builds.

RemoteStorage.log = function()
Log using console.log, when remoteStorage logging is enabled.
connect: function(userAddress)
Connect to a remoteStorage server.
disconnect: function()
“Disconnect” from remotestorage server to terminate current session.
onChange: function(path,
handler)
Add a “change” event handler to the given path.
enableLog: function()
Enable remoteStorage logging
disableLog: function()
Disable remoteStorage logging
log: function()
The same as RemoteStorage.log.
setApiKeys: function(type,
keys)
Set API keys for (currently) GoogleDrive and/or Dropbox backend support.
IndexedDB Interface
Keeps track of claimed access and scopes.
Holds/manages caching configuration.
WireClient Interface
localStorage caching adapter.
Close