js-data

Respect Your Data

Give your data the treatment it deserves with a framework-agnostic, datastore-agnostic JavaScript ORM built for ease of use and peace of mind. Works in Node.js and in the Browser.

Get Started

DS#lastSaved

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

Argument

Type

Description

resourceName

string

The name of the resource to use. Unnecessary if calling lastSaved directly on a Resource.

id

string or number

The primary key of the item whose last saved timestamp is to be retrieved.

Examples
// 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.

Updated less than a minute ago

DS#lastSaved


DS#lastSaved(resourceName, id)

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.