├── .jshintignore ├── .gitignore ├── .jshintrc ├── README.md ├── package.json ├── ampersand-sync-promise.js └── test └── index.js /.jshintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi": false, 3 | "expr": true, 4 | "loopfunc": true, 5 | "curly": false, 6 | "evil": true, 7 | "white": true, 8 | "undef": true, 9 | "node": true, 10 | "eqnull": true, 11 | "predef": [ 12 | "require", 13 | "exports", 14 | "module" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ampersand-sync-promise 2 | 3 | Standalone, modern-browser-only version of Backbone.Sync as Common JS module. 4 | 5 | Use this instead of ampersand's standard sync to return a promise instead of an XHR object. 6 | 7 | Uses the popular [Q library](https://www.npmjs.org/package/q) for promise implementation 8 | 9 | All credit to the original Ampersand JS team. 10 | 11 | ## install 12 | 13 | ``` 14 | npm install ampersand-sync-promise 15 | ``` 16 | 17 | ## running the tests 18 | 19 | ``` 20 | npm test 21 | ``` 22 | 23 | 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. 24 | 25 | You can also run `npm start` then open a browser. 26 | 27 | 28 | 29 | ## license 30 | 31 | MIT 32 | 33 | 34 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ampersand-sync-promise", 3 | "description": "Standalone, modern-browser-only version of Backbone.Sync as Common JS module. Fork of the original ampersand-js-sync, but instead returns a promise. All credit to original Ampersand JS team.", 4 | "version": "1.0.0", 5 | "author": "Stephen Grider