Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ system. Old cached data will be converted to the new format automatically.
### Breaking changes

* `getAll` and `getListing` now return an empty object instead of undefined when no items
match the query
match the query
* Object meta data has been removed from the `getListing` response, until we have a better
implementation (#652, #720, #721)
* `disconnect` event removed in favor of `disconnected`
* `remoteStorage.claimAccess` removed in favor of `remoteStorage.access.claim`
* `BaseClient#use` and `BaseClient#release` removed in favor of `BaseClient#cache`
Expand All @@ -23,12 +25,12 @@ system. Old cached data will be converted to the new format automatically.
* Major rewrite of the tree-based sync and caching system
* Performance was improved, especially when storing many small objects
* A new `maxAge` parameter is available in the various BaseClient get...
functions, where you can specify the maximum age of cached results (in ms).
This replaces the ready-queue from 0.9.0.
functions, where you can specify the maximum age of cached results (in ms).
This replaces the ready-queue from 0.9.0.
* Caching of subtrees can now be configured as 'ALL', 'SEEN', or 'FLUSH'. The second
one means documents that were seen once, will stay synced. Check the
[caching documentation](http://remotestorage.io/doc/code/files/caching-js.html)
for details. `caching.enable(path)` will use 'ALL' by default.
one means documents that were seen once, will stay synced. Check the
[caching documentation](http://remotestorage.io/doc/code/files/caching-js.html)
for details. `caching.enable(path)` will use 'ALL' by default.
* Add and use background sync interval, based on Page Visibility API (#462)
* Choose from which origins change events are emitted via `RemoteStorage.config.changeEvents`
* More unit tests
Expand Down Expand Up @@ -69,7 +71,7 @@ in the next release via https://github.com/remotestorage/remotestorage.js/issues
* Label change events from initial sync as 'local' if they come from local
* Add JSHint config
* Add in-memory storage for when neither IndexedDB nor localStorage are
available
available
* Move the example server and example apps to gh:remotestorage/starter-kit
* Add setSyncInterval method
* Add i18n module, enable translation/customization of all content strings
Expand All @@ -87,10 +89,10 @@ in the next release via https://github.com/remotestorage/remotestorage.js/issues
* Size reduced by almost 25%, to 34K minified, gzipped
* Fixes issues with non-ASCII characters in item names
* Fixes unnecessary polling of documents whose entry in the parent directory
did not change
did not change
* Widget fixes
* Compatible with [remotestorage-02](https://github.com/remotestorage/spec/blob/master/draft-dejong-remotestorage-head.txt)
(although nothing needed to change for this)
(although nothing needed to change for this)

## 0.8.1 (August 2013)

Expand Down Expand Up @@ -121,9 +123,9 @@ in the next release via https://github.com/remotestorage/remotestorage.js/issues
* Made validation schemas global (schemas from other modules can be referred to using: <module-name>/<type-alias>)
* Added 'inspect' debug widget. If debug support is built in, use remoteStorage.inspect() in your app to try it.
* Deprectated the "util" part. It contained a lot of utility functions that bloated the library and are also
available in the same or similar form from third-party libraries.
Until the next major release a subset of the "util" object will still be available (see "src/legacy.js" for
a list of methods that are included).
available in the same or similar form from third-party libraries.
Until the next major release a subset of the "util" object will still be available (see "src/legacy.js" for
a list of methods that are included).

## 0.7.0 (January 2013)

Expand Down
17 changes: 11 additions & 6 deletions src/baseclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
*
* A BaseClient deals with three types of data: folders, objects and files.
*
* <getListing> returns a list of all items within a folder, or undefined
* if a 404 is encountered. Items that end with a forward slash ("/") are
* child folders.
* <getListing> returns a mapping of all items within a folder. Items that
* end with a forward slash ("/") are child folders. For instance:
* {
* 'folder/': true,
* 'document.txt': true
* }
*
* <getObject> / <storeObject> operate on JSON objects. Each object has a type.
*
Expand Down Expand Up @@ -199,9 +202,11 @@
* Example:
* (start code)
* client.getListing('', false).then(function(listing) {
* listing.forEach(function(item) {
* console.log(item);
* });
* // listing is for instance:
* // {
* // 'folder/': true,
* // 'document.txt': true
* // }
* });
* (end code)
*/
Expand Down
8 changes: 8 additions & 0 deletions src/cachinglayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@
this.getNodes([path]).then(function(objs) {
var node = getLatest(objs[path]);
if (node) {
if (isFolder(path)) {
for (var i in node.itemsMap) {
// the hasOwnProperty check here is only because our jshint settings require it:
if (node.itemsMap.hasOwnProperty(i) && node.itemsMap[i] === false) {
delete node.itemsMap[i];
}
}
}
promise.fulfill(200, node.body || node.itemsMap, node.contentType);
} else {
promise.fulfill(404);
Expand Down
27 changes: 27 additions & 0 deletions test/unit/inmemorycaching-suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,33 @@ define(['requirejs'], function(requirejs) {
}
},

{
desc: "#get removes falsy items from local version itemsMap",
run: function(env, test) {
var requestQueued = false;
var oldTimestamp = (new Date().getTime()) - 1000;

env.rs.local._storage['/'] = {
path: '/',
common: {
itemsMap: { foo: true, bar: true },
timestamp: oldTimestamp,
revision: '123'
},
local: {
itemsMap: { foo: true, bar: false },
timestamp: oldTimestamp,
revision: '123'
}
};
env.rs.local.get('/', false).then(function(status, itemsMap) {
test.assertAnd(status, 200);
test.assertAnd(itemsMap, { foo: true });
test.done();
});
}
},

{
desc: "#get gets queued as a sync request if node is older than the maxAge",
run: function(env, test) {
Expand Down