For the past ~2 weeks me and ggrin have been working on remotestorage.js 0.8. It’s a partial rewrite and a few things have changed. They are listed in detail in the changelog: https://github.com/remotestorage/remotestorage.js/blob/develop/CHANGELOG.txt
NOTE: the widget has not fully been migrated to the latest version yet, so don’t worry if it doesn’t fully work for you. Still WIP.
This post is meant to describe some of the changes from an app developer’s perspective.
Getting 0.8:
0.8 is still in development. To get the current version, clone:
git://github.com/remotestorage/remotestorage.js
and checkout the develop
branch. There you can run make build
to get a built version of remotestorage.js. Run make minify
after that if you’d like to have a minified version (though I don’t recommend doing that in development).
Changes to module definitions:
First of all: since the remoteStorage
object is now an instance of RemoteStorage
, modules are also declared globally.
So if you have been writing remoteStorage.defineModule(...)
before, change it to RemoteStorage.defineModule(...)
and you’re good to go. There is also a deprecation message to that effect.
Secondly the BaseClient
has been changed a bit:
- The
use
andrelease
methods are deprecated in favor ofcache(path)
andcache(path), false)
. - Types/Schemas are now declared globally, scoped to the module they are defined in. This has a few implications:
- You no longer need to declare the same type/schema on both the
privateClient
and thepublicClient
. Instead just declare it on one of them and both will be able to use it (because they have the same module name). - You can refer to schemas from other modules. For example you could do
storeObject('contacts/vcard', '...', {...})
from any other module - given that the “contacts” module is included and declares the “vcard” type.
- You no longer need to declare the same type/schema on both the
- The
BaseClient
now brings ascope
methods, which returns a newBaseClient
, that operates on a subpath instead of on the module root.
Changes to configuring caching:
There are two major changes compared to 0.7:
- There no longer is a “tree only” option. Either the entire data below a path is synchronized or nothing at all.
- Caching can be configured on two levels: from a module, using the
BaseClient#cache
method, or from the app using theremoteStorage.caching
interface.
Using caching is described in detail in this guide.
The “inspect” widget:
This is a little gimmick to help developers see what’s going on and debug caching problems. Run remoteStorage.inspect()
in the console to display the inspector widget. It will show you the contents of
the connected remotestorage, the local cache and pending changes.