Skip to content

Commit

Permalink
Added details of liveupdates to the docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
latentflip committed Jan 25, 2012
1 parent 5ec537b commit 4e31577
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion Readme.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,10 +42,40 @@ archivedTasks = new Collections.ArchivedTasks();


tasks.reset([{archived: true}, {archived: false}]); tasks.reset([{archived: true}, {archived: false}]);


assert.equal(task.length, 2); assert.equal(tasks.length, 2);
assert.equal(archivedTasks.length, 1); 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 ## Tests


You must have node installed in order to run the tests. You must have node installed in order to run the tests.
Expand Down

0 comments on commit 4e31577

Please sign in to comment.