<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.rawgit.com/js-data/js-data/master/dist/js-data.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();
var Document = store.defineResource('document');
var d = Document.inject({ id: 5, author: 'John Anderson' });
d.author = 'Sally';
console.log(Document.changes(5));
## DS#changes(resourceName, id)
Synchronously return the changes object of the item of the type specified by `resourceName` that has the primary key specified by `id`. This object represents the diff between the item in its current state and the state of the item the last time it was saved via an 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 changes. |
###### Examples
```js
var d = Document.get(5); // { author: 'John Anderson', id: 5 }
d.author = 'Sally';
// You might have to do store.digest() first
// See Method Variants section below for different ways to call DS#changes
Document.changes(5); // {...} Object describing changes
```