DS#lastSaved(resourceName, id)

Return the timestamp of the last time the item of type resourceName with the given primary key was saved via an adapter.


You can call DS#lastSaved multiple ways

  • DS#lastSaved(resourceName, id)
  • Resource#lastSaved(id) - Where Resource was created by DS#defineResource
resourceNamestringThe name of the resource to use. Unnecessary if calling lastSaved directly on a Resource.
idstring or numberThe primary key of the item whose last saved timestamp is to be retrieved.
// same as store.lastSaved('document', 45)
Document.lastModified(5); // undefined
Document.lastSaved(5); // undefined

Document.find(5).then(function (document) {
  Document.lastModified(5); // 1234235825494
  Document.lastSaved(5); // 1234235825494

  document.author = 'Sally';

  // You may have to call store.digest() first

  Document.lastModified(5); // 1234304985344 - something different
  Document.lastSaved(5); // 1234235825494 - still the same
See also


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.