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#changeHistory

DS#changeHistory(resourceName, id)

Synchronously return the change history of the item of the type specified by resourceName that has the primary key specified by id. This object represents the history of changes in the item since the item was last injected or re-injected (on save, update, etc.) into the data store.

If id is not provided, return the change history for the whole resource.

Will throw an error if keepChangeHistory for the resource is false.

👍

You can call DS#changeHistory multiple ways

  • DS#changeHistory(resourceName, id)
  • Resource#changeHistory(id) - Where Resource was created by DS#defineResource
  • Instance#DSChangeHistory() - Where Instance is an instance of a Resource

Argument

Type

Description

resourceName

string

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

id

string or number

The primary key of the item for which to retrieve the change history. If not provided, return the change history for the whole resource.

Demo

📘

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#changeHistory


DS#changeHistory(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.