remotestorage/remotestorage.js — pull request #794 by silverbucket (2014-10-13 20:04:12+00:00)
Title: Feature/node support

This pull request allows for functionality on `node` with or without a remote connected. Previously we relied on the `Authorize` module to do stuff before we could be "ready" but in node the `Authorize` module returns false in `_rs_supported` (no dom).

* allow for configuration of logging during `new RemoteStorage({logging: true})` otherwise we miss initialization messages in node.
* added `hasFeature` to check if we loaded `Authorize` or not. If not, fire the `this.remote.stopWaitingForToken()` method to keep things moving.

Currently I've tested this the remotestorage-modules repo, though I have nothing committed yet. You can use this demo script:
```
var RemoteStorage = require('remotestoragejs');
var remoteStorage = new RemoteStorage({
logging: false
});
global.remoteStorage = remoteStorage;

remoteStorage.on('ready', function () {
console.log('ready!');

remoteStorage.bookmarks.archive.store({
url: 'testurl',
title: 'this about Me'
}).then(function (bm) {
console.log('-- stored a bookmark: ', bm);
remoteStorage.bookmarks.archive.getAll().then(
function (bookmarks) {
console.log('-- all bookmarks', bookmarks);
},
function (error) {
console.log('error fetching all bookmarks', error);
}
);
});

});

require('./remotestorage-bookmarks');

remoteStorage.access.claim('bookmarks', 'rw');
console.log('access claimed');

remoteStorage.caching.enable('/bookmarks/archive/');
console.log('caching enabled');

var client = remoteStorage.bookmarks.client.scope('archive/');

client.on('change', function(event){
console.log('change event', event);
});
```

You'll need the `bookmarks` module, and will need to symlink the remotestorage.js repository to `node_modules/remotestoragejs`