Permalink
Browse files

Added details of liveupdates to the docs.

  • Loading branch information...
1 parent 5ec537b commit 4e315770eebecb48cecda3ed8bc9ac49e79ea43d @latentflip latentflip committed Jan 25, 2012
Showing with 31 additions and 1 deletion.
  1. +31 −1 Readme.md
View
@@ -42,10 +42,40 @@ archivedTasks = new Collections.ArchivedTasks();
tasks.reset([{archived: true}, {archived: false}]);
-assert.equal(task.length, 2);
+assert.equal(tasks.length, 2);
assert.equal(archivedTasks.length, 1);
```
+## Live Updating of subsets
+
+By default subsets will be updated live. That is, if a models attributes
+change such that affect it's membership of a subset, that update will
+happen automatically.
+
+Continuing the above example:
+
+```
+tasks.reset([{archived: true}, {archived: false}]);
+
+assert.equal(tasks.length, 2);
+assert.equal(archivedTasks.length, 1);
+
+tasks.first().set({archived: false});
+assert.equal(tasks.length, 2);
+assert.equal(archivedTasks.length, 0);
+```
+
+### Controlling live updating
+
+Live updating is controlled by a subset's `liveupdate\_keys` attribute.
+
+To prevent live updating of a subset, set it's `liveupdate\_keys` attribute
+to be 'none'.
+
+To limit which model keys trigger a live update, set `liveupdate\_keys`
+to be an array of attributes: `liveupdate\_keys = ['archived']`.
+
+
## Tests
You must have node installed in order to run the tests.

0 comments on commit 4e31577

Please sign in to comment.