DS#previous
DS#previous(resourceName, id)
Synchronously return the previous attributes of the item of the type specified by resourceName that has the primary key specified by id. This object represents the state of the item the last time it was saved via an async adapter.
Arguments
| name | type | description |
|---|---|---|
| resourceName | string | The name of the resource to use. Unnecessary if using the resource directly. |
| id | string or number | The primary key of item for which to retrieve the previous attributes. |
Examples
var d = Document.get(5); // { author: 'John Anderson', id: 5 }
d.author = 'Sally';
d; // { author: 'Sally', id: 5 }
// You may have to do store.digest() first
// same as store.previous('document', 5)
Document.previous(5); // { author: 'John Anderson', id: 5 }
Need help?
Want more examples or have a question? Ask on the Slack channel or post on the mailing list then we'll get your question answered and probably update this wiki.
Updated less than a minute ago
