<!DOCTYPE html>
<html>

  <head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/js-data/2.9.0/js-data.min.js"></script>
    <script src="script.js"></script>
  </head>

  <body>
    <h1>Open up your console to see the output</h1>
  </body>

</html>
var store = new JSData.DS({
  keepChangeHistory: true
});

store.defineResource('document');

var doc = store.inject('document', { id: 5, author: 'John Anderson' });

doc.author = 'Sally';

doc.created = new Date();

setTimeout(function () {
  console.log(store.changeHistory('document', 5));
}, 100);
## js-data v2 - 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.