nilbus/Backbone.dualStorage — pull request #114 by eladxxx (2014-06-04 04:56:09+00:00)
Title: A bunch of changes to make DualStorage more flexible/robust

Submitted primarily for review and discussion - keeping the diff very short. Note that this is implemented in terms of Store to maintain abstraction of the storage layer.

* Make standalone models (no collection) work with DualStorage. (Issue #98)

* Model-only API:
- New model-only API: `isDirtyOrDestroyed`, returns `'dirty'`, `'destroyed'`, or `false`. (Discussed in comments to issue #98)

* Collection-only API:
- `hasDirtyOrDestroyed`, returns `true` or `false`. (Discussed in comments to issue #105)

* Model and Collection API:
- `discard(what)`, discards dirty models if `what` is `'dirty'`, destroyed models if it's `destroyed`, or both if it's falsey. When used on a standalone model, data will be discarded only if the model is dirty, destroyed, or either, respectively. (Discussed in comments to issue #105)

* Allow specifying `remote` or `true` booleans on individual Backbone.sync requests. (Discussed in comments to issue #105)