1 | # ampersand-sync
|
2 |
|
3 | Standalone, modern-browser-only version of Backbone.Sync as Common JS module.
|
4 |
|
5 | You probably won't use this directly, but it is used by ampersand-model and ampersand-rest-collection to provide the REST functionality.
|
6 |
|
7 | ## Important note on the 1.0.x versions
|
8 |
|
9 | In moving from 1.0.1 to 1.0.2 we switched the underlying ajax implementation from jQuery's ajax to [xhr](http://github.com/raynos/xhr). This changed slightly the options, as well as how `ajaxConfig` in models/collections operated when configured as a function.
|
10 |
|
11 | Previously `ajaxConfig` would be passed the current ajax parameters object for modification, now it receives no arguments and should just return options to be merged in to the ajax parameters which will be passed to xhr.
|
12 |
|
13 | This should have been a major release both for this module and it's dependents (ampersand-model, ampersand-rest-collection, ampersand-collection-rest-mixin), but unfortunately we made a mistake and published as 1.0.2, and were too slow to rollback our mistake before workarounds were in place.
|
14 |
|
15 | As such we are leaving the current 1.0.x versions in place, but deprecated, and suggest people upgrade to the latest versions of model/collection when they can which will contain the new implementation of xhr.
|
16 |
|
17 | This should only affect your if you're using `ajaxConfig` as a function. If so you'll need to return the options you want to add, rather than expecting to be passed a params object to your ajaxConfig function. If you're having trouble ping us in freenode #&yet or on twitter: [@philip_roberts](http://twitter.com/philip_roberts) & [@henrikjoreteg](http://twitter.com/henrikjoreteg).
|
18 |
|
19 |
|
20 | ## browser support
|
21 |
|
22 | [![testling badge](https://ci.testling.com/AmpersandJS/ampersand-sync.png)](https://ci.testling.com/AmpersandJS/ampersand-sync)
|
23 |
|
24 |
|
25 | Part of the [Ampersand.js toolkit](http://ampersandjs.com) for building clientside applications.
|
26 |
|
27 |
|
28 | ## install
|
29 |
|
30 | ```
|
31 | npm install ampersand-sync
|
32 | ```
|
33 |
|
34 | ## running the tests
|
35 |
|
36 | ```
|
37 | npm test
|
38 | ```
|
39 |
|
40 | Tests are written in [tape](https://github.com/substack/tape) and since they require a browser environment it gets run in a headless browser using phantomjs via [tape-run](https://github.com/juliangruber/tape-run). Make sure you have phantomjs installed for this to work.
|
41 |
|
42 | You can also run `npm start` then open a browser.
|
43 |
|
44 |
|
45 |
|
46 | ## credits
|
47 |
|
48 | All credit goes to Jeremy Ashkenas and the other Backbone.js authors.
|
49 |
|
50 | If you like this follow [@HenrikJoreteg](http://twitter.com/henrikjoreteg) on twitter.
|
51 |
|
52 |
|
53 | ## license
|
54 |
|
55 | MIT
|
56 |
|
57 |
|